summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2014-10-17 22:35:44 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2014-10-17 22:35:44 (GMT)
commitbc92bbd4d22e82e9458a3300c50b89e80b2c2d60 (patch)
tree54b073cdefd6e484fca89d31e8bd5ca57557f85a /Objects
parent4dc7278546992f1d985dd296fc0c0d884b57f0a5 (diff)
parentd6967320256a65b847cfc64173d12bf818171db5 (diff)
downloadcpython-bc92bbd4d22e82e9458a3300c50b89e80b2c2d60.zip
cpython-bc92bbd4d22e82e9458a3300c50b89e80b2c2d60.tar.gz
cpython-bc92bbd4d22e82e9458a3300c50b89e80b2c2d60.tar.bz2
Issue #22653: Fix an assertion failure in debug mode when doing a reentrant dict insertion in debug mode.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/dictobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 6c78b94..a3219f7 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;
}