fix dict gc tracking (#13903)

This commit is contained in:
Benjamin Peterson 2012-04-24 10:32:57 -04:00
parent 01296da8df
commit 7ce67e45f8
1 changed files with 3 additions and 0 deletions

View File

@ -2022,6 +2022,8 @@ PyDict_Copy(PyObject *o)
Py_XINCREF(value);
split_copy->ma_values[i] = value;
}
if (_PyObject_GC_IS_TRACKED(mp))
_PyObject_GC_TRACK(split_copy);
return (PyObject *)split_copy;
}
copy = PyDict_New();
@ -2220,6 +2222,7 @@ dict_setdefault(register PyDictObject *mp, PyObject *args)
return NULL;
ep = find_empty_slot(mp, key, hash, &value_addr);
}
MAINTAIN_TRACKING(mp, key, failobj);
ep->me_key = key;
ep->me_hash = hash;
*value_addr = failobj;