[Python-checkins] cpython (3.5): Issue #25698: Prevent possible replacing imported module with the empty one
serhiy.storchaka
python-checkins at python.org
Wed Feb 10 03:33:35 EST 2016
https://hg.python.org/cpython/rev/1c2de3b0a474
changeset: 100215:1c2de3b0a474
branch: 3.5
parent: 100210:818e91105418
user: Serhiy Storchaka <storchaka at gmail.com>
date: Wed Feb 10 10:31:20 2016 +0200
summary:
Issue #25698: Prevent possible replacing imported module with the empty one
if the stack is too deep.
files:
Python/import.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Python/import.c b/Python/import.c
--- a/Python/import.c
+++ b/Python/import.c
@@ -671,9 +671,13 @@
PyObject *modules = PyImport_GetModuleDict();
PyObject *m;
- if ((m = PyDict_GetItem(modules, name)) != NULL &&
- PyModule_Check(m))
+ if ((m = PyDict_GetItemWithError(modules, name)) != NULL &&
+ PyModule_Check(m)) {
return m;
+ }
+ if (PyErr_Occurred()) {
+ return NULL;
+ }
m = PyModule_NewObject(name);
if (m == NULL)
return NULL;
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list