Răsfoiți Sursa

this should fix obj.this on 64-bits architectures

rdb 13 ani în urmă
părinte
comite
a96c08b5c8

+ 2 - 2
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"

+ 1 - 1
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"