diff options
author | Mark Shannon <mark@hotpy.org> | 2023-02-08 09:31:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-08 09:31:12 (GMT) |
commit | feec49c40736fc05626a183a8d14c4ebbea5ae28 (patch) | |
tree | 5af6110eca8c2a21a9f699b40a87e7567c603e98 /Modules/gcmodule.c | |
parent | 027adf42cd85db41fee05b0a40d89ef822876c97 (diff) | |
download | cpython-feec49c40736fc05626a183a8d14c4ebbea5ae28.zip cpython-feec49c40736fc05626a183a8d14c4ebbea5ae28.tar.gz cpython-feec49c40736fc05626a183a8d14c4ebbea5ae28.tar.bz2 |
GH-101578: Normalize the current exception (GH-101607)
* Make sure that the current exception is always normalized.
* Remove redundant type and traceback fields for the current exception.
* Add new API functions: PyErr_GetRaisedException, PyErr_SetRaisedException
* Add new API functions: PyException_GetArgs, PyException_SetArgs
Diffstat (limited to 'Modules/gcmodule.c')
-rw-r--r-- | Modules/gcmodule.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 6630faa..5879c5e 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -2082,11 +2082,10 @@ PyGC_Collect(void) n = 0; } else { - PyObject *exc, *value, *tb; gcstate->collecting = 1; - _PyErr_Fetch(tstate, &exc, &value, &tb); + PyObject *exc = _PyErr_GetRaisedException(tstate); n = gc_collect_with_callback(tstate, NUM_GENERATIONS - 1); - _PyErr_Restore(tstate, exc, value, tb); + _PyErr_SetRaisedException(tstate, exc); gcstate->collecting = 0; } |