[Zodb-checkins] CVS: Zope3/src/persistence - persistence.c:1.15

Jeremy Hylton jeremy at zope.com
Mon May 5 14:06:27 EDT 2003


Update of /cvs-repository/Zope3/src/persistence
In directory cvs.zope.org:/tmp/cvs-serv27484

Modified Files:
	persistence.c 
Log Message:
Prevent core dump when instances doesn't have a dict.

This is a partial fix, because we need to support objects with slots,
too.


=== Zope3/src/persistence/persistence.c 1.14 => 1.15 ===
--- Zope3/src/persistence/persistence.c:1.14	Fri Apr 25 15:02:35 2003
+++ Zope3/src/persistence/persistence.c	Mon May  5 13:06:27 2003
@@ -131,12 +131,18 @@
 
     /* XXX UPDATE_STATE_IF_NECESSARY */
 
+    /* This instance has no dict. */
+    if (!pdict) {
+	/* XXX check for slots */
+	Py_INCREF(Py_None);
+	return Py_None;
+    }
+
     state = PyDict_New();
     if (state == NULL)
 	return NULL;
 
-    /* If the instance doesn't have any attributes, the dict ptr could
-       still be NULL. */
+    /* This instance never initialized its dict. */
     if ((*pdict) == NULL)
 	return state;
 




More information about the Zodb-checkins mailing list