Fix import of frozen package submodules to use Unicode. Fixes test_frozen.
This commit is contained in:
parent
3698746585
commit
13d7799f87
|
@ -1188,15 +1188,16 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
|
||||||
Py_DECREF(meta_path);
|
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"
|
/* The only type of submodule allowed inside a "frozen"
|
||||||
package are other frozen modules or packages. */
|
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,
|
PyErr_SetString(PyExc_ImportError,
|
||||||
"full frozen module name too long");
|
"full frozen module name too long");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
strcpy(buf, PyString_AsString(path));
|
strcpy(buf, p);
|
||||||
strcat(buf, ".");
|
strcat(buf, ".");
|
||||||
strcat(buf, name);
|
strcat(buf, name);
|
||||||
strcpy(name, buf);
|
strcpy(name, buf);
|
||||||
|
|
Loading…
Reference in New Issue