diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index 3e3d29f526..2b3001b84b 100755 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -1479,7 +1479,14 @@ void InterfaceMakerPythonNative::write_module_class(ostream &out, Object *obj) } } - out << " PyType_Ready(&Dtool_"<< ClassName << ".As_PyTypeObject());\n"; + out << " if(PyType_Ready(&Dtool_"<< ClassName << ".As_PyTypeObject()) < 0)\n"; + out << " {\n"; + out << " PyErr_SetString(PyExc_TypeError, \"PyType_Ready("<< ClassName << ")\");\n"; + out << " printf(\" Error In PyType_Ready" << ClassName << "\");\n"; + out << " return;\n"; + out << " }\n"; + + out << " Py_INCREF(&Dtool_"<< ClassName << ".As_PyTypeObject());\n"; out << " PyDict_SetItemString(Dtool_"<