mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (in Objects/) (#102218)
This commit is contained in:
parent
b097925858
commit
11a2c6ce51
8 changed files with 51 additions and 106 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue