gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (in Objects/) (#102218)

This commit is contained in:
Irit Katriel 2023-03-08 17:03:18 +00:00 committed by GitHub
parent b097925858
commit 11a2c6ce51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 51 additions and 106 deletions

View file

@ -1556,10 +1556,9 @@ _PyODict_SetItem_KnownHash(PyObject *od, PyObject *key, PyObject *value,
res = _odict_add_new_node((PyODictObject *)od, key, hash);
if (res < 0) {
/* Revert setting the value on the dict */
PyObject *exc, *val, *tb;
PyErr_Fetch(&exc, &val, &tb);
PyObject *exc = PyErr_GetRaisedException();
(void) _PyDict_DelItem_KnownHash(od, key, hash);
_PyErr_ChainExceptions(exc, val, tb);
_PyErr_ChainExceptions1(exc);
}
}
return res;