aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
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 35292b6478a..6a4d5937686 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;
}