From 10d51abb5358c67e42df9332edf246caaf845e35 Mon Sep 17 00:00:00 2001 From: Toby Dickenson <htrd@svn.zope.org> Date: Tue, 2 Apr 2002 11:11:45 +0000 Subject: [PATCH] improved some comments --- trunk/src/Persistence/cPersistence.c | 5 ++--- trunk/src/Persistence/cPickleCache.c | 11 ++++++++--- trunk/src/ZODB/cPersistence.c | 5 ++--- trunk/src/ZODB/cPickleCache.c | 11 ++++++++--- trunk/src/persistent/cPersistence.c | 5 ++--- trunk/src/persistent/cPickleCache.c | 11 ++++++++--- 6 files changed, 30 insertions(+), 18 deletions(-) diff --git a/trunk/src/Persistence/cPersistence.c b/trunk/src/Persistence/cPersistence.c index 62344383..e40a5510 100644 --- a/trunk/src/Persistence/cPersistence.c +++ b/trunk/src/Persistence/cPersistence.c @@ -14,7 +14,7 @@ static char cPersistence_doc_string[] = "Defines Persistent mixin class for persistent objects.\n" "\n" -"$Id: cPersistence.c,v 1.53 2002/04/02 06:01:22 jeremy Exp $\n"; +"$Id: cPersistence.c,v 1.54 2002/04/02 11:11:45 htrd Exp $\n"; #include "cPersistence.h" @@ -190,9 +190,8 @@ deallocated(cPersistentObject *self) /* XXX should just add this to the C API struct */ v = PyObject_CallMethod((PyObject *)self->cache, "_oid_unreferenced", "O", self->oid); - /* XXX What does the comment below mean? */ if (v == NULL) - PyErr_Clear(); /* and explode later */ + PyErr_Clear(); /* I dont think this should ever happen */ else Py_DECREF(v); } diff --git a/trunk/src/Persistence/cPickleCache.c b/trunk/src/Persistence/cPickleCache.c index 7d8ab648..1d5ca48a 100644 --- a/trunk/src/Persistence/cPickleCache.c +++ b/trunk/src/Persistence/cPickleCache.c @@ -15,7 +15,7 @@ static char cPickleCache_doc_string[] = "Defines the PickleCache used by ZODB Connection objects.\n" "\n" -"$Id: cPickleCache.c,v 1.45 2002/04/02 06:03:39 jeremy Exp $\n"; +"$Id: cPickleCache.c,v 1.46 2002/04/02 11:11:45 htrd Exp $\n"; #define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;} #define UNLESS(E) if(!(E)) @@ -442,11 +442,16 @@ cc_lru_items(ccobject *self, PyObject *args) return l; } -/* XXX What does this function do? */ - static PyObject * cc_oid_unreferenced(ccobject *self, PyObject *args) { + /* This is called by the persistent object deallocation + function when the reference count on a persistent + object reaches zero. We need to fix up our dictionary; + its reference is now dangling because we stole its + reference count. Be careful to not release the global + interpreter lock until this is complete. */ + PyObject *oid, *v; if (!PyArg_ParseTuple(args, "O:_oid_unreferenced", &oid)) return NULL; diff --git a/trunk/src/ZODB/cPersistence.c b/trunk/src/ZODB/cPersistence.c index 62344383..e40a5510 100644 --- a/trunk/src/ZODB/cPersistence.c +++ b/trunk/src/ZODB/cPersistence.c @@ -14,7 +14,7 @@ static char cPersistence_doc_string[] = "Defines Persistent mixin class for persistent objects.\n" "\n" -"$Id: cPersistence.c,v 1.53 2002/04/02 06:01:22 jeremy Exp $\n"; +"$Id: cPersistence.c,v 1.54 2002/04/02 11:11:45 htrd Exp $\n"; #include "cPersistence.h" @@ -190,9 +190,8 @@ deallocated(cPersistentObject *self) /* XXX should just add this to the C API struct */ v = PyObject_CallMethod((PyObject *)self->cache, "_oid_unreferenced", "O", self->oid); - /* XXX What does the comment below mean? */ if (v == NULL) - PyErr_Clear(); /* and explode later */ + PyErr_Clear(); /* I dont think this should ever happen */ else Py_DECREF(v); } diff --git a/trunk/src/ZODB/cPickleCache.c b/trunk/src/ZODB/cPickleCache.c index 7d8ab648..1d5ca48a 100644 --- a/trunk/src/ZODB/cPickleCache.c +++ b/trunk/src/ZODB/cPickleCache.c @@ -15,7 +15,7 @@ static char cPickleCache_doc_string[] = "Defines the PickleCache used by ZODB Connection objects.\n" "\n" -"$Id: cPickleCache.c,v 1.45 2002/04/02 06:03:39 jeremy Exp $\n"; +"$Id: cPickleCache.c,v 1.46 2002/04/02 11:11:45 htrd Exp $\n"; #define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;} #define UNLESS(E) if(!(E)) @@ -442,11 +442,16 @@ cc_lru_items(ccobject *self, PyObject *args) return l; } -/* XXX What does this function do? */ - static PyObject * cc_oid_unreferenced(ccobject *self, PyObject *args) { + /* This is called by the persistent object deallocation + function when the reference count on a persistent + object reaches zero. We need to fix up our dictionary; + its reference is now dangling because we stole its + reference count. Be careful to not release the global + interpreter lock until this is complete. */ + PyObject *oid, *v; if (!PyArg_ParseTuple(args, "O:_oid_unreferenced", &oid)) return NULL; diff --git a/trunk/src/persistent/cPersistence.c b/trunk/src/persistent/cPersistence.c index 62344383..e40a5510 100644 --- a/trunk/src/persistent/cPersistence.c +++ b/trunk/src/persistent/cPersistence.c @@ -14,7 +14,7 @@ static char cPersistence_doc_string[] = "Defines Persistent mixin class for persistent objects.\n" "\n" -"$Id: cPersistence.c,v 1.53 2002/04/02 06:01:22 jeremy Exp $\n"; +"$Id: cPersistence.c,v 1.54 2002/04/02 11:11:45 htrd Exp $\n"; #include "cPersistence.h" @@ -190,9 +190,8 @@ deallocated(cPersistentObject *self) /* XXX should just add this to the C API struct */ v = PyObject_CallMethod((PyObject *)self->cache, "_oid_unreferenced", "O", self->oid); - /* XXX What does the comment below mean? */ if (v == NULL) - PyErr_Clear(); /* and explode later */ + PyErr_Clear(); /* I dont think this should ever happen */ else Py_DECREF(v); } diff --git a/trunk/src/persistent/cPickleCache.c b/trunk/src/persistent/cPickleCache.c index 7d8ab648..1d5ca48a 100644 --- a/trunk/src/persistent/cPickleCache.c +++ b/trunk/src/persistent/cPickleCache.c @@ -15,7 +15,7 @@ static char cPickleCache_doc_string[] = "Defines the PickleCache used by ZODB Connection objects.\n" "\n" -"$Id: cPickleCache.c,v 1.45 2002/04/02 06:03:39 jeremy Exp $\n"; +"$Id: cPickleCache.c,v 1.46 2002/04/02 11:11:45 htrd Exp $\n"; #define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;} #define UNLESS(E) if(!(E)) @@ -442,11 +442,16 @@ cc_lru_items(ccobject *self, PyObject *args) return l; } -/* XXX What does this function do? */ - static PyObject * cc_oid_unreferenced(ccobject *self, PyObject *args) { + /* This is called by the persistent object deallocation + function when the reference count on a persistent + object reaches zero. We need to fix up our dictionary; + its reference is now dangling because we stole its + reference count. Be careful to not release the global + interpreter lock until this is complete. */ + PyObject *oid, *v; if (!PyArg_ParseTuple(args, "O:_oid_unreferenced", &oid)) return NULL; -- 2.30.9