summaryrefslogtreecommitdiff
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-02-08 09:31:12 +0000
committerGitHub <noreply@github.com>2023-02-08 09:31:12 +0000
commitfeec49c40736fc05626a183a8d14c4ebbea5ae28 (patch)
tree5af6110eca8c2a21a9f699b40a87e7567c603e98 /Python/pythonrun.c
parent027adf42cd85db41fee05b0a40d89ef822876c97 (diff)
downloadcpython-git-feec49c40736fc05626a183a8d14c4ebbea5ae28.tar.gz
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 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 35292b6478..6a4d593768 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -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;
}