whichmodule(): remove redundant PyErr_Clear(); add explicit setting

of error when sys.modules isn't there.
This commit is contained in:
Guido van Rossum 1998-05-14 02:34:46 +00:00
parent 02759c03f1
commit ed33a3f415
1 changed files with 3 additions and 4 deletions

View File

@ -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))) {