Commit 23f7da6f authored by Jim Fulton's avatar Jim Fulton

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.
parent 49f7e5fe
......@@ -280,6 +280,12 @@ pickle_slotnames(PyTypeObject *cls)
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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment