From a96c08b5c8da820a5810253e4d89c9473489cf3f Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 9 Mar 2012 21:32:47 +0000 Subject: [PATCH] this should fix obj.this on 64-bits architectures --- dtool/src/interrogate/functionWriterPtrFromPython.cxx | 4 ++-- dtool/src/interrogate/functionWriterPtrToPython.cxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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"