[Zodb-checkins] CVS: ZODB3/Persistence - cPersistence.c:1.72.8.16
cPickleCache.c:1.85.8.3
Jeremy Hylton
jeremy at zope.com
Mon Jul 7 15:11:53 EDT 2003
Update of /cvs-repository/ZODB3/Persistence
In directory cvs.zope.org:/tmp/cvs-serv25817/Persistence
Modified Files:
Tag: zodb33-devel-branch
cPersistence.c cPickleCache.c
Log Message:
Remove some circular reference band-aids from the ZODB trunk.
Get rid of dodgy _breakcr() code, which was causing segfaults in weird
places. We'll rely on GC instead.
Remove clear() method on cache, since it was only called from _breakcr().
Call ghostify() from Per_clear() to attempt to free references in a
clean way. This may not be necessary when the rest of GC support gets
implemented.
Make DB and Connection new-style classes to aid in debugging.
=== ZODB3/Persistence/cPersistence.c 1.72.8.15 => 1.72.8.16 ===
--- ZODB3/Persistence/cPersistence.c:1.72.8.15 Mon Jul 7 12:15:22 2003
+++ ZODB3/Persistence/cPersistence.c Mon Jul 7 14:11:17 2003
@@ -412,6 +412,7 @@
Per_clear(cPersistentObject *self)
{
/* XXX Will subtype_clear() handle the instance dict? */
+ ghostify(self);
Py_XDECREF(self->jar);
Py_XDECREF(self->oid);
Py_XDECREF(self->cache);
=== ZODB3/Persistence/cPickleCache.c 1.85.8.2 => 1.85.8.3 ===
--- ZODB3/Persistence/cPickleCache.c:1.85.8.2 Wed Jul 2 18:37:39 2003
+++ ZODB3/Persistence/cPickleCache.c Mon Jul 7 14:11:17 2003
@@ -463,46 +463,6 @@
return l;
}
-/* Be very careful about calling clear().
-
- It removes all non-ghost objects from the ring without otherwise
- removing them from the cache. The method should only be called
- after the cache is no longer in use.
-*/
-
-static PyObject *
-cc_clear(ccobject *self, PyObject *args)
-{
- CPersistentRing *here;
-
- if (!PyArg_ParseTuple(args, ":clear"))
- return NULL;
-
- if (self->ring_lock) {
- /* When the ring lock is held, we have no way of know which
- ring nodes belong to persistent objects, and which a
- placeholders. */
- PyErr_SetString(PyExc_ValueError,
- ".lru_items() is unavailable during garbage collection");
- return NULL;
- }
-
- self->ring_lock = 1;
- while ((here = self->ring_home.next) != & self->ring_home) {
- cPersistentObject *o = OBJECT_FROM_RING(self, here, "clear");
-
- self->non_ghost_count--;
- o->ring.next->prev = &self->ring_home;
- self->ring_home.next = o->ring.next;
- o->ring.next = NULL;
- o->ring.prev = NULL;
- Py_DECREF(o);
- }
- self->ring_lock = 0;
- Py_INCREF(Py_None);
- return Py_None;
-}
-
static int
cc_oid_unreferenced(ccobject *self, PyObject *oid)
{
@@ -609,8 +569,6 @@
"get(key [, default]) -- get an item, or a default"},
{"ringlen", (PyCFunction)cc_ringlen, METH_VARARGS,
"ringlen() -- Returns number of non-ghost items in cache."},
- {"clear", (PyCFunction)cc_clear, METH_VARARGS,
- "clear() -- remove all objects from the cache"},
{NULL, NULL} /* sentinel */
};
More information about the Zodb-checkins
mailing list