Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 51996:4563e6120544
Issue #5273: Fixed import failure on unicode path. (especially on windows)
| author | Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp> |
|---|---|
| date | Wed, 04 Mar 2009 01:52:10 +0000 |
| parents | 643d8d4fc8eb |
| children | 56983cfdf5d4 |
line wrap: on
line diff
--- a/Python/import.c Wed Mar 04 01:10:09 2009 +0000 +++ b/Python/import.c Wed Mar 04 01:52:10 2009 +0000 @@ -990,13 +990,15 @@ { 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);
