diff --git a/dtool/src/interrogate/functionWriterPtrFromPython.cxx b/dtool/src/interrogate/functionWriterPtrFromPython.cxx index 1afffc9520..7bed0fdebe 100644 --- a/dtool/src/interrogate/functionWriterPtrFromPython.cxx +++ b/dtool/src/interrogate/functionWriterPtrFromPython.cxx @@ -78,9 +78,9 @@ write_code(ostream &out) { << " PyObject *in_dict = ((PyInstanceObject *)obj)->in_dict;\n" << " if (in_dict != (PyObject *)NULL && PyDict_Check(in_dict)) {\n" << " PyObject *thisobj = PyDict_GetItemString(in_dict, \"this\");\n" - << " if (thisobj != (PyObject *)NULL && PyInt_Check(thisobj)) {\n" + << " if (thisobj != (PyObject *)NULL && PyLong_Check(thisobj)) {\n" << " (*addr) = (" - << _pointer_type->get_local_name(&parser) << ")PyInt_AsLong(thisobj);\n" + << _pointer_type->get_local_name(&parser) << ")PyLong_AsVoidPtr(thisobj);\n" << " return 1;\n" << " }\n" << " }\n" diff --git a/dtool/src/interrogate/functionWriterPtrToPython.cxx b/dtool/src/interrogate/functionWriterPtrToPython.cxx index 6ee16a4e8b..4c26c294cb 100644 --- a/dtool/src/interrogate/functionWriterPtrToPython.cxx +++ b/dtool/src/interrogate/functionWriterPtrToPython.cxx @@ -73,7 +73,7 @@ write_code(ostream &out) { << " PyObject *classobj = " << classobj_func << "();\n" << " PyInstanceObject *instance = (PyInstanceObject *)PyInstance_New(classobj, (PyObject *)NULL, (PyObject *)NULL);\n" << " if (instance != (PyInstanceObject *)NULL) {\n" - << " PyObject *thisptr = PyInt_FromLong((long)addr);\n" + << " PyObject *thisptr = PyLong_FromVoidPtr((void*)addr);\n" << " PyDict_SetItemString(instance->in_dict, \"this\", thisptr);\n" << " }\n" << " return (PyObject *)instance;\n"