diff options
author | Zackery Spytz <zspytz@gmail.com> | 2018-07-03 19:47:22 (GMT) |
---|---|---|
committer | Antoine Pitrou <pitrou@free.fr> | 2018-07-03 19:47:22 (GMT) |
commit | d8cba5d16f1333fd625726fc72e66afbd45b8d00 (patch) | |
tree | 6aa57f4d44036535b4cdf7895e92cd235a5b8f4f /Python | |
parent | 831c29721dcb1b768c6315a4b8a4059c4c97ee8b (diff) | |
download | cpython-d8cba5d16f1333fd625726fc72e66afbd45b8d00.zip cpython-d8cba5d16f1333fd625726fc72e66afbd45b8d00.tar.gz cpython-d8cba5d16f1333fd625726fc72e66afbd45b8d00.tar.bz2 |
bpo-24596: Decref module in PyRun_SimpleFileExFlags() on SystemExit (GH-7918)
PyErr_Print() will not return when the exception is a SystemExit, so
decref the __main__ module object in that case.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pythonrun.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 5cf7c33..bcd1ca9 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -431,6 +431,7 @@ PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit, } flush_io(); if (v == NULL) { + Py_CLEAR(m); PyErr_Print(); goto done; } @@ -439,7 +440,7 @@ PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit, done: if (set_file_name && PyDict_DelItemString(d, "__file__")) PyErr_Clear(); - Py_DECREF(m); + Py_XDECREF(m); return ret; } |