diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2014-10-17 22:35:00 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2014-10-17 22:35:00 (GMT) |
commit | d6967320256a65b847cfc64173d12bf818171db5 (patch) | |
tree | da653da4d00d3b839e078cd39ac146e597c265b6 /Objects/dictobject.c | |
parent | baa6d3a01f9716e96ccc8126c863a8e5916e910c (diff) | |
download | cpython-d6967320256a65b847cfc64173d12bf818171db5.zip cpython-d6967320256a65b847cfc64173d12bf818171db5.tar.gz cpython-d6967320256a65b847cfc64173d12bf818171db5.tar.bz2 |
Issue #22653: Fix an assertion failure in debug mode when doing a reentrant dict insertion in debug mode.
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r-- | Objects/dictobject.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 1ccea6e..bab6242 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -814,13 +814,14 @@ insertdict(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject *value) if (ep == NULL) { return -1; } + assert(PyUnicode_CheckExact(key) || mp->ma_keys->dk_lookup == lookdict); Py_INCREF(value); MAINTAIN_TRACKING(mp, key, value); old_value = *value_addr; if (old_value != NULL) { assert(ep->me_key != NULL && ep->me_key != dummy); *value_addr = value; - Py_DECREF(old_value); /* which **CAN** re-enter */ + Py_DECREF(old_value); /* which **CAN** re-enter (see issue #22653) */ } else { if (ep->me_key == NULL) { @@ -851,9 +852,8 @@ insertdict(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject *value) } mp->ma_used++; *value_addr = value; + assert(ep->me_key != NULL && ep->me_key != dummy); } - assert(ep->me_key != NULL && ep->me_key != dummy); - assert(PyUnicode_CheckExact(key) || mp->ma_keys->dk_lookup == lookdict); return 0; } |