summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-05-14 02:34:46 (GMT)
committerGuido van Rossum <guido@python.org>1998-05-14 02:34:46 (GMT)
commited33a3f41560a8847179f92fa004ba1741215b7b (patch)
tree93a7f818a2d7c210c96651e78d4490d81350564e /Modules
parent02759c03f1f1bee6f33e2919bdbaa778ef2b8288 (diff)
downloadcpython-ed33a3f41560a8847179f92fa004ba1741215b7b.zip
cpython-ed33a3f41560a8847179f92fa004ba1741215b7b.tar.gz
cpython-ed33a3f41560a8847179f92fa004ba1741215b7b.tar.bz2
whichmodule(): remove redundant PyErr_Clear(); add explicit setting
of error when sys.modules isn't there.
Diffstat (limited to 'Modules')
-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))) {