[Python-checkins] python/dist/src/Python import.c,2.242,2.243

birkenfeld@users.sourceforge.net birkenfeld at users.sourceforge.net
Wed Sep 14 08:56:23 CEST 2005


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24343/Python

Modified Files:
	import.c 
Log Message:
Patch #1290454: Fix reload() error message when parent module is not in
sys.modules.



Index: import.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/import.c,v
retrieving revision 2.242
retrieving revision 2.243
diff -u -d -r2.242 -r2.243
--- import.c	3 Jun 2005 14:41:54 -0000	2.242
+++ import.c	14 Sep 2005 06:56:20 -0000	2.243
@@ -2288,13 +2288,14 @@
 		if (parentname == NULL)
 			return NULL;
 		parent = PyDict_GetItem(modules, parentname);
-		Py_DECREF(parentname);
 		if (parent == NULL) {
 			PyErr_Format(PyExc_ImportError,
 			    "reload(): parent %.200s not in sys.modules",
-			    name);
+			    PyString_AS_STRING(parentname));
+			Py_DECREF(parentname);
 			return NULL;
 		}
+		Py_DECREF(parentname);
 		subname++;
 		path = PyObject_GetAttrString(parent, "__path__");
 		if (path == NULL)



More information about the Python-checkins mailing list