Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 288ed03 + 48a583b commit 5b613ddCopy full SHA for 5b613dd
1 file changed
Python/import.c
@@ -671,9 +671,13 @@ PyImport_AddModuleObject(PyObject *name)
671
PyObject *modules = PyImport_GetModuleDict();
672
PyObject *m;
673
674
- if ((m = PyDict_GetItem(modules, name)) != NULL &&
675
- PyModule_Check(m))
+ if ((m = PyDict_GetItemWithError(modules, name)) != NULL &&
+ PyModule_Check(m)) {
676
return m;
677
+ }
678
+ if (PyErr_Occurred()) {
679
+ return NULL;
680
681
m = PyModule_NewObject(name);
682
if (m == NULL)
683
return NULL;
0 commit comments