Skip to content

Commit 3756f01

Browse files
committed
Change get_tp_name to get_fully_qualified_tp_name
1 parent 587ba52 commit 3756f01

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

include/pybind11/cast.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
4040
PYBIND11_NAMESPACE_BEGIN(detail)
4141

4242
// Forward-declaration; see detail/class.h
43-
std::string get_tp_name(PyTypeObject*);
43+
std::string get_fully_qualified_tp_name(PyTypeObject*);
4444

4545
/// A life support system for temporary objects created by `type_caster::load()`.
4646
/// Adding a patient will keep it alive up until the enclosing function returns.
@@ -345,8 +345,8 @@ PYBIND11_NOINLINE inline value_and_holder instance::get_value_and_holder(const t
345345
"(compile in debug mode for type details)");
346346
#else
347347
pybind11_fail("pybind11::detail::instance::get_value_and_holder: `" +
348-
get_tp_name(find_type->type) + "' is not a pybind11 base of the given `" +
349-
get_tp_name(Py_TYPE(this)) + "' instance");
348+
get_fully_qualified_tp_name(find_type->type) + "' is not a pybind11 base of the given `" +
349+
get_fully_qualified_tp_name(Py_TYPE(this)) + "' instance");
350350
#endif
351351
}
352352

include/pybind11/detail/class.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ PYBIND11_NAMESPACE_BEGIN(detail)
2424
# define PYBIND11_SET_OLDPY_QUALNAME(obj, nameobj) setattr((PyObject *) obj, "__qualname__", nameobj)
2525
#endif
2626

27-
inline std::string get_tp_name(PyTypeObject *type) {
27+
inline std::string get_fully_qualified_tp_name(PyTypeObject *type) {
2828
#if !defined(PYPY_VERSION)
2929
return type->tp_name;
3030
#else
@@ -180,7 +180,7 @@ extern "C" inline PyObject *pybind11_meta_call(PyObject *type, PyObject *args, P
180180
for (const auto &vh : values_and_holders(instance)) {
181181
if (!vh.holder_constructed()) {
182182
PyErr_Format(PyExc_TypeError, "%.200s.__init__() must be called when overriding __init__",
183-
get_tp_name(vh.type->type).c_str());
183+
get_fully_qualified_tp_name(vh.type->type).c_str());
184184
Py_DECREF(self);
185185
return nullptr;
186186
}
@@ -312,7 +312,7 @@ extern "C" inline PyObject *pybind11_object_new(PyTypeObject *type, PyObject *,
312312
/// following default function will be used which simply throws an exception.
313313
extern "C" inline int pybind11_object_init(PyObject *self, PyObject *, PyObject *) {
314314
PyTypeObject *type = Py_TYPE(self);
315-
std::string msg = get_tp_name(type) + ": No constructor defined!";
315+
std::string msg = get_fully_qualified_tp_name(type) + ": No constructor defined!";
316316
PyErr_SetString(PyExc_TypeError, msg.c_str());
317317
return -1;
318318
}
@@ -451,7 +451,7 @@ extern "C" inline PyObject *pybind11_get_dict(PyObject *self, void *) {
451451
extern "C" inline int pybind11_set_dict(PyObject *self, PyObject *new_dict, void *) {
452452
if (!PyDict_Check(new_dict)) {
453453
PyErr_Format(PyExc_TypeError, "__dict__ must be set to a dictionary, not a '%.200s'",
454-
get_tp_name(Py_TYPE(new_dict)).c_str());
454+
get_fully_qualified_p_name(Py_TYPE(new_dict)).c_str());
455455
return -1;
456456
}
457457
PyObject *&dict = *_PyObject_GetDictPtr(self);

include/pybind11/pybind11.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ class cpp_function : public function {
242242

243243
#if !defined(NDEBUG) && !defined(PYBIND11_DISABLE_NEW_STYLE_INIT_WARNING)
244244
if (rec->is_constructor && !rec->is_new_style_constructor) {
245-
const auto class_name = detail::get_tp_name((PyTypeObject *) rec->scope.ptr());
245+
const auto class_name = detail::get_fully_qualified_tp_name((PyTypeObject *) rec->scope.ptr());
246246
const auto func_name = std::string(rec->name);
247247
PyErr_WarnEx(
248248
PyExc_FutureWarning,
@@ -1033,7 +1033,7 @@ class generic_type : public object {
10331033
if (!type->ht_type.tp_as_buffer)
10341034
pybind11_fail(
10351035
"To be able to register buffer protocol support for the type '" +
1036-
get_tp_name(tinfo->type) +
1036+
get_fully_qualified_tp_name(tinfo->type) +
10371037
"' the associated class<>(..) invocation must "
10381038
"include the pybind11::buffer_protocol() annotation!");
10391039

0 commit comments

Comments
 (0)