From: Guido van Rossum Date: Thu, 14 May 1998 02:34:46 +0000 (+0000) Subject: whichmodule(): remove redundant PyErr_Clear(); add explicit setting X-Git-Tag: v1.5.2a1~641 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ed33a3f41560a8847179f92fa004ba1741215b7b;p=thirdparty%2FPython%2Fcpython.git whichmodule(): remove redundant PyErr_Clear(); add explicit setting of error when sys.modules isn't there. --- diff --git a/Modules/cPickle.c b/Modules/cPickle.c index 9af979b8d2f9..9f426cc10527 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))) {