mirror of
https://github.com/python/cpython.git
synced 2026-01-13 02:40:11 +00:00
bpo-24596: Decref module in PyRun_SimpleFileExFlags() on SystemExit (GH-7918) (GH-8069)
PyErr_Print() will not return when the exception is a SystemExit, so
decref the __main__ module object in that case.
(cherry picked from commit d8cba5d16f)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
This commit is contained in:
parent
f55a818954
commit
e1ebf51f76
3 changed files with 20 additions and 2 deletions
|
|
@ -421,6 +421,7 @@ PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit,
|
|||
}
|
||||
flush_io();
|
||||
if (v == NULL) {
|
||||
Py_CLEAR(m);
|
||||
PyErr_Print();
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -429,7 +430,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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue