summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-07-23 03:16:50 (GMT)
committerGuido van Rossum <guido@python.org>2007-07-23 03:16:50 (GMT)
commit13d7799f87ac3da61dfb3437b0768cfedc1d763b (patch)
treea239946cdc183af43176c0a18aa6a6ee5c410931 /Python
parent3698746585c1e06d43f231da51175dabba35250f (diff)
downloadcpython-13d7799f87ac3da61dfb3437b0768cfedc1d763b.zip
cpython-13d7799f87ac3da61dfb3437b0768cfedc1d763b.tar.gz
cpython-13d7799f87ac3da61dfb3437b0768cfedc1d763b.tar.bz2
Fix import of frozen package submodules to use Unicode. Fixes test_frozen.
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Python/import.c b/Python/import.c
index cd76fa2..25c768f 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1188,15 +1188,16 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
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);