diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2023-02-24 21:43:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-24 21:43:03 (GMT) |
commit | 2db23d10bf64bf7c061fd95c6a8079ddc5c9aa4b (patch) | |
tree | aa29d63d7151d976ea301f5fadff1821333690c9 /Modules/posixmodule.c | |
parent | 568fc0dee42a353f327b059a48f97c911de904b3 (diff) | |
download | cpython-2db23d10bf64bf7c061fd95c6a8079ddc5c9aa4b.zip cpython-2db23d10bf64bf7c061fd95c6a8079ddc5c9aa4b.tar.gz cpython-2db23d10bf64bf7c061fd95c6a8079ddc5c9aa4b.tar.bz2 |
gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (in Modules/) (#102196)
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 51aa89e..6ea216b 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -14759,10 +14759,9 @@ ScandirIterator_exit(ScandirIterator *self, PyObject *args) static void ScandirIterator_finalize(ScandirIterator *iterator) { - PyObject *error_type, *error_value, *error_traceback; /* Save the current exception, if any. */ - PyErr_Fetch(&error_type, &error_value, &error_traceback); + PyObject *exc = PyErr_GetRaisedException(); if (!ScandirIterator_is_closed(iterator)) { ScandirIterator_closedir(iterator); @@ -14779,7 +14778,7 @@ ScandirIterator_finalize(ScandirIterator *iterator) path_cleanup(&iterator->path); /* Restore the saved exception. */ - PyErr_Restore(error_type, error_value, error_traceback); + PyErr_SetRaisedException(exc); } static void |