diff Python/import.c @ 42347:5e66bb69c1e3

Fix import of frozen package submodules to use Unicode. Fixes test_frozen.
author Guido van Rossum <guido@python.org>
date Mon, 23 Jul 2007 03:16:50 +0000
parents e70cdce0e8b2
children 81ade0144247
line wrap: on
line diff
--- a/Python/import.c	Mon Jul 23 02:57:24 2007 +0000
+++ b/Python/import.c	Mon Jul 23 03:16:50 2007 +0000
@@ -1188,15 +1188,16 @@
 		Py_DECREF(meta_path);
 	}
 
-	if (path != NULL && PyString_Check(path)) {
+	if (path != NULL && PyUnicode_Check(path)) {
 		/* The only type of submodule allowed inside a "frozen"
 		   package are other frozen modules or packages. */
-		if (PyString_Size(path) + 1 + strlen(name) >= (size_t)buflen) {
+		char *p = PyUnicode_AsString(path);
+		if (strlen(p) + 1 + strlen(name) >= (size_t)buflen) {
 			PyErr_SetString(PyExc_ImportError,
 					"full frozen module name too long");
 			return NULL;
 		}
-		strcpy(buf, PyString_AsString(path));
+		strcpy(buf, p);
 		strcat(buf, ".");
 		strcat(buf, name);
 		strcpy(name, buf);