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

This commit is contained in:
Hirokazu Yamamoto 2009-03-04 01:52:10 +00:00
parent 7c9875c32c
commit 4f447fb9a1

View file

@ -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);