[Zope3-checkins] CVS: Zope3/src/ZODB - coptimizations.c:1.26.6.2

Jim Fulton jim at zope.com
Fri Jan 9 15:11:50 EST 2004


Update of /cvs-repository/Zope3/src/ZODB
In directory cvs.zope.org:/tmp/cvs-serv1700

Modified Files:
      Tag: zope3-zodb3-devel-branch
	coptimizations.c 
Log Message:
Moved incref for klass to write after assignment, since we decref it
on some exit paths.

Added an initial value for "__get__".

Added some whitespace.


=== Zope3/src/ZODB/coptimizations.c 1.26.6.1 => 1.26.6.2 ===
--- Zope3/src/ZODB/coptimizations.c:1.26.6.1	Fri Jan  9 14:48:53 2004
+++ Zope3/src/ZODB/coptimizations.c	Fri Jan  9 15:11:49 2004
@@ -156,7 +156,7 @@
     /* We have a persistent object or a non-persistent class. */
     
     oid = PyObject_GetAttr(object, py__p_oid);
-    if (!oid) {
+    if (! oid) {
 	PyErr_Clear();
 	goto return_none;
     }
@@ -176,7 +176,7 @@
 	       strings, although some other user of Persistent could
 	       use something else.
 	    */
-	    static PyObject *__get__;
+	    static PyObject *__get__ = NULL;
 	    PyObject *descr;
 	    if (!__get__) {
 		__get__ = PyString_InternFromString("__get__");
@@ -206,7 +206,7 @@
 
         
 	jar = PyObject_GetAttr(object, py__p_jar);
-	if (!jar)
+	if (! jar)
 	    PyErr_Clear();
 	else {
 	    if (jar != Py_None && jar != self->jar) {
@@ -230,6 +230,7 @@
     }
 
     klass = (PyObject *)object->ob_type;
+    Py_INCREF(klass);
     if (PyObject_HasAttr(klass, py___getnewargs__))
 	goto return_oid;
 
@@ -238,7 +239,6 @@
 	goto err;
 
     /* use borrowed reference to oid */
-    Py_INCREF(klass);
     PyTuple_SET_ITEM(t1, 0, oid);
     PyTuple_SET_ITEM(t1, 1, klass);
 




More information about the Zope3-Checkins mailing list