[Zope3-checkins] CVS: Zope/lib/python/persistent - cPickleCache.c:1.91

Jeremy Hylton jeremy at zope.com
Tue Mar 2 17:13:55 EST 2004


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

Modified Files:
	cPickleCache.c 
Log Message:
Call _p_invalidate() instead of indirecting through _p_changed.


=== Zope/lib/python/persistent/cPickleCache.c 1.90 => 1.91 ===
--- Zope/lib/python/persistent/cPickleCache.c:1.90	Tue Mar  2 10:37:38 2004
+++ Zope/lib/python/persistent/cPickleCache.c	Tue Mar  2 17:13:54 2004
@@ -311,8 +311,20 @@
 static void
 _invalidate(ccobject *self, PyObject *key)
 {
+    static PyObject *_p_invalidate;
     PyObject *v = PyDict_GetItem(self->data, key);
 
+    if (!_p_invalidate) {
+	_p_invalidate = PyString_InternFromString("_p_invalidate");
+	if (!_p_invalidate) {
+	    /* It doesn't make any sense to ignore this error, but
+	       the caller ignores all errors.
+	    */
+	    PyErr_Clear();
+	    return;
+	}
+    }
+
     if (!v)
 	return;
     if (PyType_Check(v)) {
@@ -336,7 +348,16 @@
 		PyErr_Clear();
 	}
     } else {
-	if (PyObject_DelAttr(v, py__p_changed) < 0)
+	PyObject *meth, *err;
+
+	meth = PyObject_GetAttr(v, _p_invalidate);
+	if (!meth) {
+	    PyErr_Clear();
+	    return;
+	}
+	err = PyObject_CallObject(meth, NULL);
+	Py_DECREF(meth);
+	if (!err)
 	    PyErr_Clear();
     }
 }




More information about the Zope3-Checkins mailing list