Commit 4f447fb9 authored by Hirokazu Yamamoto's avatar Hirokazu Yamamoto

Issue #5273: Fixed import failure on unicode path. (especially on windows)

parent 7c9875c3
......@@ -990,13 +990,15 @@ update_compiled_module(PyCodeObject *co, char *pathname)
{
PyObject *oldname, *newname;
if (!PyUnicode_CompareWithASCIIString(co->co_filename, pathname))
return 0;
newname = PyUnicode_FromString(pathname);
newname = PyUnicode_DecodeFSDefault(pathname);
if (newname == NULL)
return -1;
if (!PyUnicode_Compare(co->co_filename, newname)) {
Py_DECREF(newname);
return 0;
}
oldname = co->co_filename;
Py_INCREF(oldname);
update_code_filenames(co, oldname, newname);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment