mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (in Modules/) (#102196)
This commit is contained in:
parent
568fc0dee4
commit
2db23d10bf
18 changed files with 136 additions and 169 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue