Commit d5f353ec authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #24726: Revert setting the value on the dict if

_odict_add_new_node() fails.
parent 9c967611
......@@ -1721,7 +1721,13 @@ PyODict_SetItem(PyObject *od, PyObject *key, PyObject *value) {
int res = PyDict_SetItem(od, key, value);
if (res == 0) {
res = _odict_add_new_node((PyODictObject *)od, key);
/* XXX Revert setting the value on the dict? */
if (res < 0) {
/* Revert setting the value on the dict */
PyObject *exc, *val, *tb;
PyErr_Fetch(&exc, &val, &tb);
(void) PyDict_DelItem(od, key);
_PyErr_ChainExceptions(exc, val, tb);
}
}
return res;
};
......
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