Skip to content
Permalink
Browse files

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.
  • Loading branch information
rdb committed Nov 6, 2019
1 parent bbb334a commit d2bd4181e0d2eae10b467b70870d1cbd0b8035bc
Showing with 2 additions and 3 deletions.
  1. +2 −3 dtool/src/interrogate/interfaceMakerPythonNative.cxx
@@ -2874,7 +2874,7 @@ write_module_class(ostream &out, Object *obj) {
// const char *tp_name;
out << " \"" << _def->module_name << "." << export_class_name << "\",\n";
// Py_ssize_t tp_basicsize;
out << " sizeof(Dtool_PyInstDef),\n";
out << " 0, // tp_basicsize\n"; // inherited from tp_base
// Py_ssize_t tp_itemsize;
out << " 0, // tp_itemsize\n";

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

out << " Dtool_" << ClassName << "._PyType.tp_bases = PyTuple_Pack(" << bases.size() << baseargs << ");\n";
} else {
out << " Dtool_" << ClassName << "._PyType.tp_base = (PyTypeObject *)Dtool_GetSuperBase();\n";
}
out << " Dtool_" << ClassName << "._PyType.tp_base = (PyTypeObject *)Dtool_GetSuperBase();\n";

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

0 comments on commit d2bd418

Please sign in to comment.
You can’t perform that action at this time.