mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
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
This commit is contained in:
parent
027adf42cd
commit
feec49c407
29 changed files with 477 additions and 172 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue