summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2009-03-04 01:52:10 (GMT)
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2009-03-04 01:52:10 (GMT)
commit4f447fb9a1605b7c3f1e5513b925b9213ef9480c (patch)
tree8ab88e234e82ef146924a47d4f6bcc7e51955b34 /Python
parent7c9875c32c30ac6f70305001581400cdc0142088 (diff)
downloadcpython-4f447fb9a1605b7c3f1e5513b925b9213ef9480c.zip
cpython-4f447fb9a1605b7c3f1e5513b925b9213ef9480c.tar.gz
cpython-4f447fb9a1605b7c3f1e5513b925b9213ef9480c.tar.bz2
Issue #5273: Fixed import failure on unicode path. (especially on windows)
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Python/import.c b/Python/import.c
index 11cbc58..1cd3dc7 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -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);