[Zope-Checkins] CVS: ZODB3/Persistence - cPickleCache.c:1.85.8.2

Jeremy Hylton jeremy@zope.com
Wed, 2 Jul 2003 18:37:43 -0400


Update of /cvs-repository/ZODB3/Persistence
In directory cvs.zope.org:/tmp/cvs-serv4142

Modified Files:
      Tag: zodb33-devel-branch
	cPickleCache.c 
Log Message:
Fix for assert() failure in GC.


=== ZODB3/Persistence/cPickleCache.c 1.85.8.1 => 1.85.8.2 ===
--- ZODB3/Persistence/cPickleCache.c:1.85.8.1	Tue Jul  1 15:28:11 2003
+++ ZODB3/Persistence/cPickleCache.c	Wed Jul  2 18:37:39 2003
@@ -919,6 +919,17 @@
 	Py_DECREF(self);
 	return NULL;
     }
+    /* Untrack the dict mapping oids to objects.
+
+    The dict contains uncounted references to ghost objects, so it
+    isn't safe for GC to visit it.  If GC finds an object with more
+    referents that refcounts, it will die with an assertion failure.
+
+    When the cache participates in GC, it will need to traverse the
+    objects in the doubly-linked list, which will account for all the
+    non-ghost objects.
+    */
+    PyObject_GC_UnTrack((void *)self->data);
     self->setklassstate = PyObject_GetAttrString(jar, "setklassstate");
     if (self->setklassstate == NULL) {
 	Py_DECREF(self);