File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,27 @@ test_initializer multiple_inheritance([](py::module &m) {
43
43
44
44
py::class_<MIType, Base12>(m, " MIType" )
45
45
.def (py::init<int , int >());
46
+
47
+ // FIXME: Temporary to debug PyPy behaviour
48
+ m.def (" debug_tp_bases" , [](py::object pbo) {
49
+ PyObject *o = pbo.ptr ();
50
+ if (PyType_Check (o)) {
51
+ PyTypeObject *t = (PyTypeObject *) o;
52
+ py::print (" Type `{}' tp_bases:" _s.format (t->tp_name ));
53
+ if (!PyTuple_Check (t->tp_bases )) {
54
+ py::print (" (null tp_bases)" );
55
+ }
56
+ else {
57
+ for (int i = 0 ; i < PyTuple_GET_SIZE (t->tp_bases ); i++) {
58
+ PyObject *subtype = PyTuple_GET_ITEM (t->tp_bases , i);
59
+ if (PyType_Check (subtype))
60
+ py::print (" - {}" _s.format (((PyTypeObject *) subtype)->tp_name ));
61
+ else
62
+ py::print (" - (unknown - not a type?)" );
63
+ }
64
+ }
65
+ }
66
+ });
46
67
});
47
68
48
69
/* Test the case where not all base classes are specified,
You can’t perform that action at this time.
0 commit comments