[Zope-Checkins] CVS: Zope/lib/python/ZODB - coptimizations.c:1.17.60.4

Jeremy Hylton jeremy@zope.com
Fri, 13 Dec 2002 16:40:37 -0500


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

Modified Files:
      Tag: Zope-2_6-branch
	coptimizations.c 
Log Message:
Get ZClasses working.  (Tested this time.)

The test for ZClass in persistent_id_call() was in the wrong place.
If get_class_tuple() fails, it just returns the oid passed in.  (It
can't return NULL, because it needs to reserve that for errors.)  The
caller should return the oid in this case.


=== Zope/lib/python/ZODB/coptimizations.c 1.17.60.3 => 1.17.60.4 ===
--- Zope/lib/python/ZODB/coptimizations.c:1.17.60.3	Fri Dec 13 16:27:38 2002
+++ Zope/lib/python/ZODB/coptimizations.c	Fri Dec 13 16:40:37 2002
@@ -110,7 +110,7 @@
 	goto err;
     if (!PyObject_IsTrue(module)) {
 	Py_DECREF(module);
-	/* XXX Handle degenerate 1.x ZClass case. */
+	/* If the class has no __module__, it must be a degnerate ZClass. */
 	return oid;
     }
 
@@ -205,12 +205,11 @@
 	|| PyObject_HasAttr(klass, py___getinitargs__))
 	goto return_oid;
 
-    /* If this is an extension class, just return _p_oid. */
-    if (!klass)
-	goto return_oid;
     t2 = get_class_tuple(klass, oid);
     if (!t2)
 	goto err;
+    if (t2 == oid) /* Couldn't find class info, just used oid. */
+	goto return_oid;
     t1 = PyTuple_New(2);
     if (!t1) {
 	Py_DECREF(t2);