[Python-3000-checkins] r58838 - python/branches/py3k/Python/import.c

christian.heimes python-3000-checkins at python.org
Sun Nov 4 13:10:02 CET 2007


Author: christian.heimes
Date: Sun Nov  4 13:10:01 2007
New Revision: 58838

Modified:
   python/branches/py3k/Python/import.c
Log:
Applied patch #1379 with a minor tweak.
PyModule_GetName() returns a char* from PyUnicode_AsString but the code in import.c was using PyString_FromString on it.

Modified: python/branches/py3k/Python/import.c
==============================================================================
--- python/branches/py3k/Python/import.c	(original)
+++ python/branches/py3k/Python/import.c	Sun Nov  4 13:10:01 2007
@@ -2384,7 +2384,7 @@
 		subname = name;
 	else {
 		PyObject *parentname, *parent;
-		parentname = PyString_FromStringAndSize(name, (subname-name));
+		parentname = PyUnicode_FromStringAndSize(name, (subname-name));
 		if (parentname == NULL) {
 			imp_modules_reloading_clear();
 			return NULL;
@@ -2393,7 +2393,7 @@
 		if (parent == NULL) {
 			PyErr_Format(PyExc_ImportError,
 			    "reload(): parent %.200s not in sys.modules",
-			    PyString_AS_STRING(parentname));
+			     PyUnicode_AsString(parentname));
 			Py_DECREF(parentname);
 			imp_modules_reloading_clear();
 			return NULL;


More information about the Python-3000-checkins mailing list