mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (in Python/) (#102193)
This commit is contained in:
parent
85b1fc1fc5
commit
4c87537efb
8 changed files with 42 additions and 72 deletions
|
@ -1633,8 +1633,7 @@ static void
|
|||
compiler_exit_scope(struct compiler *c)
|
||||
{
|
||||
// Don't call PySequence_DelItem() with an exception raised
|
||||
PyObject *exc_type, *exc_val, *exc_tb;
|
||||
PyErr_Fetch(&exc_type, &exc_val, &exc_tb);
|
||||
PyObject *exc = PyErr_GetRaisedException();
|
||||
|
||||
c->c_nestlevel--;
|
||||
compiler_unit_free(c->u);
|
||||
|
@ -1655,7 +1654,7 @@ compiler_exit_scope(struct compiler *c)
|
|||
c->u = NULL;
|
||||
}
|
||||
|
||||
PyErr_Restore(exc_type, exc_val, exc_tb);
|
||||
PyErr_SetRaisedException(exc);
|
||||
}
|
||||
|
||||
/* Search if variable annotations are present statically in a block. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue