]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 70157 via svnmerge from
authorHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
Wed, 4 Mar 2009 01:58:09 +0000 (01:58 +0000)
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
Wed, 4 Mar 2009 01:58:09 +0000 (01:58 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r70157 | hirokazu.yamamoto | 2009-03-04 10:52:10 +0900 | 1 line

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

Python/import.c

index 397bfd81cfae76d5bd5c5747f267b60c299ac910..998a3f1bd47228f1b8f484eb82728c1b455022d7 100644 (file)
@@ -988,13 +988,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);