[Zodb-checkins] CVS: ZODB3/ZODB - cPickleCache.c:1.84
Jeremy Hylton
jeremy at zope.com
Tue May 13 20:15:17 EDT 2003
Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv2537
Modified Files:
cPickleCache.c
Log Message:
Remove big whole in cc_getattr().
Only expose the items attribute of the special dict inside the cache.
Exposing other methods that mutate the dict is dangerous, because of
the ref count games the cache plays.
=== ZODB3/ZODB/cPickleCache.c 1.83 => 1.84 ===
--- ZODB3/ZODB/cPickleCache.c:1.83 Thu May 1 13:08:39 2003
+++ ZODB3/ZODB/cPickleCache.c Tue May 13 19:15:16 2003
@@ -626,8 +626,6 @@
static PyObject *
cc_getattr(ccobject *self, char *name)
{
- PyObject *r;
-
if(*name=='c')
{
if(strcmp(name,"cache_age")==0)
@@ -646,16 +644,10 @@
return PyDict_Copy(self->data);
}
}
- if((*name=='h' && strcmp(name, "has_key")==0) ||
- (*name=='i' && strcmp(name, "items")==0) ||
- (*name=='k' && strcmp(name, "keys")==0)
- )
- return PyObject_GetAttrString(self->data, name);
- if((r=Py_FindMethod(cc_methods, (PyObject *)self, name)))
- return r;
- PyErr_Clear();
- return PyObject_GetAttrString(self->data, name);
+ if (strcmp(name, "items") == 0)
+ return PyObject_GetAttrString(self->data, name);
+ return Py_FindMethod(cc_methods, (PyObject *)self, name);
}
static int
More information about the Zodb-checkins
mailing list