mirror of https://github.com/python/cpython
whichmodule(): remove redundant PyErr_Clear(); add explicit setting
of error when sys.modules isn't there.
This commit is contained in:
parent
02759c03f1
commit
ed33a3f415
|
@ -682,12 +682,11 @@ whichmodule(PyObject *class_map, PyObject *global, PyObject *global_name) {
|
|||
Py_INCREF(module);
|
||||
return module;
|
||||
}
|
||||
else {
|
||||
PyErr_Clear();
|
||||
}
|
||||
|
||||
UNLESS(modules_dict = PySys_GetObject("modules"))
|
||||
UNLESS(modules_dict = PySys_GetObject("modules")) {
|
||||
PyErr_SetString(PyExc_SystemError, "lost sys.modules");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while ((j = PyDict_Next(modules_dict, &i, &name, &module))) {
|
||||
|
|
Loading…
Reference in New Issue