[Zodb-checkins] CVS: Zope/lib/python/ZODB - cPickleCache.c:1.61
Toby Dickenson
tdickenson@geminidataloggers.com
Wed, 17 Apr 2002 13:18:38 -0400
Update of /cvs-repository/Zope/lib/python/ZODB
In directory cvs.zope.org:/tmp/cvs-serv5761
Modified Files:
cPickleCache.c
Log Message:
fixed ZClass-related type-checking breakage introduced in reformatting in rev 1.45. I guess there are no unit tests for ZClasses?
=== Zope/lib/python/ZODB/cPickleCache.c 1.60 => 1.61 ===
{
int result;
- PyExtensionClass *class;
PyObject *oid, *object_again;
cPersistentObject *p;
- if (!PyExtensionInstance_Check(v)) {
- PyErr_SetString(PyExc_TypeError,
- "Cache values must be persistent objects.");
- return -1;
+ if (PyExtensionClass_Check(v)) {
+ /* Its a persistent class, such as a ZClass. Thats ok. */
+ }
+ else if( PyExtensionInstance_Check(v) &&
+ (((PyExtensionClass*)(v->ob_type))->class_flags & PERSISTENT_TYPE_FLAG) &&
+ (v->ob_type->tp_basicsize >= sizeof(cPersistentObject)) ) {
+ /* Its and instance of a persistent class, (ie Python classeses that
+ derive from Persistence.Persistent, BTrees, etc). Thats ok. */
}
- class = (PyExtensionClass *)(v->ob_type);
- if (!((class->class_flags & PERSISTENT_TYPE_FLAG)
- && v->ob_type->tp_basicsize >= sizeof(cPersistentObject))) {
+ else {
PyErr_SetString(PyExc_TypeError,
"Cache values must be persistent objects.");
- /* Must be either persistent classes (ie ZClasses), or instances
- of persistent classes (ie Python classeses that derive from
- Persistence.Persistent, BTrees, etc) */
return -1;
}