Author: guido.van.rossum
Date: Mon Jul 23 05:16:50 2007
New Revision: 56503

Modified:
   python/branches/py3k-struni/Python/import.c
Log:
Fix import of frozen package submodules to use Unicode.  Fixes test_frozen.


Modified: python/branches/py3k-struni/Python/import.c
==============================================================================
--- python/branches/py3k-struni/Python/import.c (original)
+++ python/branches/py3k-struni/Python/import.c Mon Jul 23 05:16:50 2007
@@ -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);
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to