Commit 35aec74b 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 7e60a9b4
......@@ -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