mirror of
https://github.com/python/cpython.git
synced 2025-07-23 19:25:40 +00:00
Issue #5273: Fixed import failure on unicode path. (especially on windows)
This commit is contained in:
parent
7c9875c32c
commit
4f447fb9a1
1 changed files with 6 additions and 4 deletions
|
@ -990,13 +990,15 @@ update_compiled_module(PyCodeObject *co, char *pathname)
|
||||||
{
|
{
|
||||||
PyObject *oldname, *newname;
|
PyObject *oldname, *newname;
|
||||||
|
|
||||||
if (!PyUnicode_CompareWithASCIIString(co->co_filename, pathname))
|
newname = PyUnicode_DecodeFSDefault(pathname);
|
||||||
return 0;
|
|
||||||
|
|
||||||
newname = PyUnicode_FromString(pathname);
|
|
||||||
if (newname == NULL)
|
if (newname == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (!PyUnicode_Compare(co->co_filename, newname)) {
|
||||||
|
Py_DECREF(newname);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
oldname = co->co_filename;
|
oldname = co->co_filename;
|
||||||
Py_INCREF(oldname);
|
Py_INCREF(oldname);
|
||||||
update_code_filenames(co, oldname, newname);
|
update_code_filenames(co, oldname, newname);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue