We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d8664ad commit f2424c5Copy full SHA for f2424c5
include/pybind11/detail/class.h
@@ -28,7 +28,20 @@ inline std::string get_fully_qualified_tp_name(PyTypeObject *type) {
28
#if !defined(PYPY_VERSION)
29
return type->tp_name;
30
#else
31
- return handle((PyObject *) type).attr("__module__").cast<std::string>() + "." + type->tp_name;
+ auto module_name = handle((PyObject *) type).attr("__module__").cast<std::string>();
32
+ bool is_builtin_module = module_name ==
33
+# if PY_MAJOR_VERSION >= 3
34
+ "builtins"
35
+# else
36
+ "__builtin__"
37
+# endif
38
+ ;
39
+ if (is_builtin_module) {
40
+ return type->tp_name;
41
+ }
42
+ else {
43
+ return std::move(module_name) + "." + type->tp_name;
44
45
#endif
46
}
47
0 commit comments