mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00: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
|
@ -748,13 +748,10 @@ _Py_HandleSystemExit(int *exitcode_p)
|
|||
}
|
||||
|
||||
done:
|
||||
/* Restore and clear the exception info, in order to properly decref
|
||||
* the exception, value, and traceback. If we just exit instead,
|
||||
* these leak, which confuses PYTHONDUMPREFS output, and may prevent
|
||||
* some finalizers from running.
|
||||
*/
|
||||
PyErr_Restore(exception, value, tb);
|
||||
PyErr_Clear();
|
||||
/* Cleanup the exception */
|
||||
Py_CLEAR(exception);
|
||||
Py_CLEAR(value);
|
||||
Py_CLEAR(tb);
|
||||
*exitcode_p = exitcode;
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue