[Python-checkins] python/dist/src/Python import.c,2.240,2.240.2.1

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


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

Modified Files:
      Tag: release24-maint
	import.c 
Log Message:
Backport of patch #1290454: Fix reload() error message when parent is not
in sys.modules.



Index: import.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/import.c,v
retrieving revision 2.240
retrieving revision 2.240.2.1
diff -u -d -r2.240 -r2.240.2.1
--- import.c	7 Oct 2004 06:46:25 -0000	2.240
+++ import.c	14 Sep 2005 06:56:51 -0000	2.240.2.1
@@ -2298,13 +2298,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