From a48fd263273c70351af38f5febbdbd4de156b0e6 Mon Sep 17 00:00:00 2001 From: doomchild Date: Tue, 6 Apr 2010 16:23:49 -0500 Subject: [PATCH] changed from using Py_XDECREF to Py_CLEAR --- dfhack/python/DF_API.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dfhack/python/DF_API.cpp b/dfhack/python/DF_API.cpp index 733b8322a..a3592ba89 100644 --- a/dfhack/python/DF_API.cpp +++ b/dfhack/python/DF_API.cpp @@ -85,6 +85,10 @@ static void DF_API_dealloc(DF_API* self) { if(self != NULL) { + Py_CLEAR(self->mem_info); + Py_CLEAR(self->position); + Py_CLEAR(self->material); + if(self->api_Ptr != NULL) { delete self->api_Ptr; @@ -92,10 +96,6 @@ static void DF_API_dealloc(DF_API* self) self->api_Ptr = NULL; } - Py_XDECREF(self->mem_info); - Py_XDECREF(self->position); - Py_XDECREF(self->material); - self->ob_type->tp_free((PyObject*)self); } } @@ -145,7 +145,7 @@ static PyObject* DF_API_getMemoryInfo(DF_API* self, void* closure) { if(self->api_Ptr != NULL) { - self->mem_info = _PyObject_New(&DF_MemInfo_type); + self->mem_info = PyObject_Call((PyObject*)&DF_MemInfo_type, NULL, NULL); if(self->mem_info != NULL) { @@ -174,7 +174,7 @@ static PyObject* DF_API_getPosition(DF_API* self, void* closure) { if(self->api_Ptr != NULL) { - self->position = _PyObject_New(&DF_Position_type); + self->position = PyObject_Call((PyObject*)&DF_Position_type, NULL, NULL); if(self->position != NULL) { @@ -203,7 +203,7 @@ static PyObject* DF_API_getMaterial(DF_API* self, void* closure) { if(self->api_Ptr != NULL) { - self->material = _PyObject_New(&DF_Material_type); + self->material = PyObject_Call((PyObject*)&DF_Material_type, NULL, NULL); if(self->material != NULL) {