]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
whichmodule(): remove redundant PyErr_Clear(); add explicit setting
authorGuido van Rossum <guido@python.org>
Thu, 14 May 1998 02:34:46 +0000 (02:34 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 14 May 1998 02:34:46 +0000 (02:34 +0000)
of error when sys.modules isn't there.

Modules/cPickle.c

index 9af979b8d2f9dbd6fc1c2b8a2ccf6e02100a7018..9f426cc105279cf33c6ed81a22fbb68220481e19 100644 (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))) {