diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2023-02-28 11:50:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-28 11:50:52 (GMT) |
commit | 4c87537efb5fd28b4e4ee9631076ed5953720156 (patch) | |
tree | 8c8bf4b1c849bc47dc28561d0653c95b33e357db /Python/compile.c | |
parent | 85b1fc1fc5a2e49d521382eaf5e7793175d00371 (diff) | |
download | cpython-4c87537efb5fd28b4e4ee9631076ed5953720156.zip cpython-4c87537efb5fd28b4e4ee9631076ed5953720156.tar.gz cpython-4c87537efb5fd28b4e4ee9631076ed5953720156.tar.bz2 |
gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (in Python/) (#102193)
Diffstat (limited to 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Python/compile.c b/Python/compile.c index 2f1130e..b14c637 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -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. */ |