Skip to content

Commit d2bd418

Browse files
committed
interrogate: set tp_base to DTOOL_SUPER_BASE and tp_basicsize to 0
The tp_basicsize field, as well as a few others, seem to be inherited from whatever is set in tp_base. In absence of a tp_base, Python will set it to PyBaseObject_Type, which is not at all correct for Panda types.
1 parent bbb334a commit d2bd418

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

dtool/src/interrogate/interfaceMakerPythonNative.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,7 +2874,7 @@ write_module_class(ostream &out, Object *obj) {
28742874
// const char *tp_name;
28752875
out << " \"" << _def->module_name << "." << export_class_name << "\",\n";
28762876
// Py_ssize_t tp_basicsize;
2877-
out << " sizeof(Dtool_PyInstDef),\n";
2877+
out << " 0, // tp_basicsize\n"; // inherited from tp_base
28782878
// Py_ssize_t tp_itemsize;
28792879
out << " 0, // tp_itemsize\n";
28802880

@@ -3137,9 +3137,8 @@ write_module_class(ostream &out, Object *obj) {
31373137
}
31383138

31393139
out << " Dtool_" << ClassName << "._PyType.tp_bases = PyTuple_Pack(" << bases.size() << baseargs << ");\n";
3140-
} else {
3141-
out << " Dtool_" << ClassName << "._PyType.tp_base = (PyTypeObject *)Dtool_GetSuperBase();\n";
31423140
}
3141+
out << " Dtool_" << ClassName << "._PyType.tp_base = (PyTypeObject *)Dtool_GetSuperBase();\n";
31433142

31443143
int num_nested = obj->_itype.number_of_nested_types();
31453144
int num_dict_items = 1;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy