mirror of
https://github.com/python/cpython.git
synced 2026-10-28 18:35:21 +08:00
bpo-30167: Remove __cached__ from __main__ when removing __file__ (GH-7415)
This commit is contained in:
1 parent
9fbcfc08e5
commit
82daa60def
2 files changed
+10
-2
No files matched your search
+8
-2
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user