SVN: ZODB/trunk/src/persistent/cPersistence.c Minor optimization in __getstate__ to avoid a needless dict allocation
Jim Fulton <[email protected]>
| Newsgroups | gmane.comp.python.zope.zodb.cvs |
|---|---|
| Message-ID | <[email protected]> |
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;
}