[Zodb-checkins] SVN: ZODB/trunk/src/persistent/cPersistence.c Minor optimization in __getstate__ to avoid a needless dict allocation
Jim Fulton
jim at zope.com
Sun Aug 23 11:29:26 EDT 2009
Log message for revision 103109:
Minor optimization in __getstate__ to avoid a needless dict allocation
for objects that don't use slots, which are the vast majority of
persistent objects.
Changed:
U ZODB/trunk/src/persistent/cPersistence.c
-=-
Modified: ZODB/trunk/src/persistent/cPersistence.c
===================================================================
--- ZODB/trunk/src/persistent/cPersistence.c 2009-08-23 14:34:05 UTC (rev 103108)
+++ ZODB/trunk/src/persistent/cPersistence.c 2009-08-23 15:29:26 UTC (rev 103109)
@@ -280,6 +280,12 @@
slotnames = PyDict_GetItem(cls->tp_dict, py___slotnames__);
if (slotnames)
{
+ int n = PyObject_Not(slotnames);
+ if (n < 0)
+ return NULL;
+ if (n)
+ slotnames = Py_None;
+
Py_INCREF(slotnames);
return slotnames;
}
More information about the Zodb-checkins
mailing list