summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/cPickle.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 9af979b..9f426cc 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -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))) {