diff options
author | Guido van Rossum <guido@python.org> | 1998-05-14 02:34:46 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-05-14 02:34:46 (GMT) |
commit | ed33a3f41560a8847179f92fa004ba1741215b7b (patch) | |
tree | 93a7f818a2d7c210c96651e78d4490d81350564e /Modules | |
parent | 02759c03f1f1bee6f33e2919bdbaa778ef2b8288 (diff) | |
download | cpython-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.c | 7 |
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))) { |