diff options
author | INADA Naoki <methane@users.noreply.github.com> | 2018-11-29 11:01:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-29 11:01:27 (GMT) |
commit | 82daa60defbd6497efdaa6c1132ecc8563122ed5 (patch) | |
tree | 605a888ef029f47e1873f2184a06b1628bb4adff /Python/pythonrun.c | |
parent | 9fbcfc08e5814d7aa9287740187e461425a99f67 (diff) | |
download | cpython-82daa60defbd6497efdaa6c1132ecc8563122ed5.zip cpython-82daa60defbd6497efdaa6c1132ecc8563122ed5.tar.gz cpython-82daa60defbd6497efdaa6c1132ecc8563122ed5.tar.bz2 |
bpo-30167: Remove __cached__ from __main__ when removing __file__ (GH-7415)
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r-- | Python/pythonrun.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 2d5dc88..9b6371d 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -434,8 +434,14 @@ PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit, Py_DECREF(v); ret = 0; done: - if (set_file_name && PyDict_DelItemString(d, "__file__")) - PyErr_Clear(); + if (set_file_name) { + if (PyDict_DelItemString(d, "__file__")) { + PyErr_Clear(); + } + if (PyDict_DelItemString(d, "__cached__")) { + PyErr_Clear(); + } + } Py_XDECREF(m); return ret; } |