[Zodb-checkins] CVS: Zope/lib/python/ZODB - TimeStamp.c:1.10.16.3 cPersistence.c:1.47.16.3 cPickleCache.c:1.37.16.3 coptimizations.c:1.14.16.3

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


Update of /cvs-repository/Zope/lib/python/ZODB
In directory cvs.zope.org:/tmp/cvs-serv14868

Modified Files:
      Tag: Zope-2_5-branch
	TimeStamp.c cPersistence.c cPickleCache.c coptimizations.c 
Log Message:
Backport bug fixes from trunk.  

Original checkin message follows:

(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.

Also replace bare malloc() and realloc() with PyMem_Malloc() and
PyMem_Realloc().  I think this isn't a strict bug fix, but a would be
nice.  It guarantees that BTrees objects get their memory from the
same allocator as the Python core.


=== Zope/lib/python/ZODB/TimeStamp.c 1.10.16.2 => 1.10.16.3 ===
   Py_DECREF(self->ob_type);
 #endif  
-  PyMem_DEL(self);
+  PyObject_DEL(self);
 }
 
 static PyObject *


=== Zope/lib/python/ZODB/cPersistence.c 1.47.16.2 => 1.47.16.3 ===
   Py_XDECREF(self->oid);
   Py_DECREF(self->ob_type);
-  PyMem_DEL(self);
+  PyObject_DEL(self);
 }
 
 static PyObject *


=== Zope/lib/python/ZODB/cPickleCache.c 1.37.16.2 => 1.37.16.3 ===
     Py_XDECREF(self->jar);
     Py_XDECREF(self->setklassstate);
-    PyMem_DEL(self);
+    PyObject_DEL(self);
 }
 
 static PyObject *


=== Zope/lib/python/ZODB/coptimizations.c 1.14.16.2 => 1.14.16.3 ===
   Py_DECREF(self->stackup);
   Py_XDECREF(self->new_oid);
-  PyMem_DEL(self);
+  PyObject_DEL(self);
 }
 
 static PyObject *