[Zodb-checkins] CVS: StandaloneZODB/ExtensionClass/src - Acquisition.c:1.57 ExtensionClass.c:1.51 ThreadLock.c:1.12

Jeremy Hylton jeremy@zope.com
Fri, 8 Mar 2002 13:34:25 -0500


Update of /cvs-repository/StandaloneZODB/ExtensionClass/src
In directory cvs.zope.org:/tmp/cvs-serv27237

Modified Files:
	Acquisition.c ExtensionClass.c ThreadLock.c 
Log Message:
(Possibly) correct use of Python memory APIs.

Fix SF bug #516768 reported by Dave Wallace.

Replace use of PyMem_DEL() with PyObject_Del() on object dealloc
functions.  The use of PyMem_DEL() is incorrect for object
deallocation, because it only ever calls the low-level free().  If a
custom allocator like pymalloc is used, it needs to be called to free
the memory.


=== StandaloneZODB/ExtensionClass/src/Acquisition.c 1.56 => 1.57 ===
   else 
     {
-      PyMem_DEL(self);
+      PyObject_DEL(self);
     }
 }
 


=== StandaloneZODB/ExtensionClass/src/ExtensionClass.c 1.50 => 1.51 ===
       Py_XDECREF(self->ob_type);
   }
-  PyMem_DEL(self);
+  PyObject_DEL(self);
 }
   
 static PyObject *
@@ -3074,7 +3074,7 @@
   UNLESS(base_dealloced) 
     {
       Py_DECREF(self->ob_type);
-      PyMem_DEL(self);
+      PyObject_DEL(self);
     }
 
   PyErr_Restore(t,v,tb);


=== StandaloneZODB/ExtensionClass/src/ThreadLock.c 1.11 => 1.12 ===
   free_lock(self->lock);
 #endif
-  PyMem_DEL(self);
+  PyObject_DEL(self);
 }
 
 static PyObject *
@@ -274,7 +274,7 @@
 #ifdef WITH_THREAD
   self->lock = allocate_lock();
   if (self->lock == NULL) {
-    PyMem_DEL(self);
+    PyObject_DEL(self);
     self = NULL;
     PyErr_SetString(ErrorObject, "can't allocate lock");
   }