Skip to content

Commit

Permalink
clean up refcounting around INTERN_INPLACE
Browse files Browse the repository at this point in the history
  • Loading branch information
davisagli committed Mar 30, 2015
1 parent 7bd85c1 commit 62543ae
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions persistent/cPersistence.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,14 +559,13 @@ pickle___setstate__(PyObject *self, PyObject *state)
while (PyDict_Next(state, &i, &d_key, &d_value)) {
/* normally the keys for instance attributes are
interned. we should try to do that here. */
Py_INCREF(d_key);
if (NATIVE_CHECK_EXACT(d_key))
if (NATIVE_CHECK_EXACT(d_key)) {
Py_INCREF(d_key);
INTERN_INPLACE(&d_key);
if (PyObject_SetItem(*dict, d_key, d_value) < 0) {
Py_DECREF(d_key);
return NULL;
}
Py_DECREF(d_key);
if (PyObject_SetItem(*dict, d_key, d_value) < 0)
return NULL;
}
}

Expand Down

0 comments on commit 62543ae

Please sign in to comment.