You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Change filename encoding to FS encoding in PyErr_WarnExplicit() #54988
PyErr_WarnExplicit() expects a filename encoded to UTF-8. This function is only called twice in the Python interpreter: compiler_assert() (with "assertion is always true, perhaps remove parentheses?") and symtable_warn() (eg. with "name 'xxx' is assigned to before global declaration"), and both functions pass a filename encoded to the filesystem encoding.
PyErr_WarnExplicit() should use the filesystem encoding instead of UTF-8 to decode the filename. I already did the same change in issue bpo-9713 and bpo-10114 (r85569).
Attached patch fixes this issue.
See also issue bpo-10778 (decoding_fgets() (tokenizer.c) decodes the filename from the wrong encoding).
Activity
vstinner commentedon Dec 27, 2010
PyErr_WarnExplicit() expects a filename encoded to UTF-8. This function is only called twice in the Python interpreter: compiler_assert() (with "assertion is always true, perhaps remove parentheses?") and symtable_warn() (eg. with "name 'xxx' is assigned to before global declaration"), and both functions pass a filename encoded to the filesystem encoding.
PyErr_WarnExplicit() should use the filesystem encoding instead of UTF-8 to decode the filename. I already did the same change in issue bpo-9713 and bpo-10114 (r85569).
Attached patch fixes this issue.
See also issue bpo-10778 (decoding_fgets() (tokenizer.c) decodes the filename from the wrong encoding).
vstinner commentedon Dec 27, 2010
Fixed by r87517.