[Zodb-checkins] CVS: ZODB3/ZODB - cPersistence.c:1.67

Jeremy Hylton jeremy@zope.com
Tue, 1 Apr 2003 12:33:24 -0500


Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv18715

Modified Files:
	cPersistence.c 
Log Message:
Remove Py_INCREF and Py_DECREF for objects in doubly linked list.

The cache is intended to keep weak references to objects.  An object
should be deallocated when the only references to it are in the
cache.  If an object is unghostified and added to the list of live
objects, the list should have a borrowed reference.  Otherwise, the
cache will keep the object alive after all other references have
disappeared. 


=== ZODB3/ZODB/cPersistence.c 1.66 => 1.67 ===
--- ZODB3/ZODB/cPersistence.c:1.66	Tue Apr  1 11:08:14 2003
+++ ZODB3/ZODB/cPersistence.c	Tue Apr  1 12:33:23 2003
@@ -131,7 +131,6 @@
             self->ring.prev = home->prev;
 	    home->prev->next = &self->ring;
 	    home->prev = &self->ring;
-            Py_INCREF(self);
         }
         self->state = cPersistent_CHANGED_STATE;
         /* Call the object's __setstate__() */
@@ -185,14 +184,6 @@
     self->ring.prev = NULL;
     self->ring.next = NULL;
     self->state = cPersistent_GHOST_STATE;
-
-    /* We remove the reference to the just ghosted object that the ring
-     * holds.  Note that the dictionary of oids->objects has an uncounted
-     * reference, so if the ring's reference was the only one, this frees
-     * the ghost object.  Note further that the object's dealloc knows to
-     * inform the dictionary that it is going away.
-     */
-    Py_DECREF(self);
 }
 
 static void