classification
Title: Change filename encoding to FS encoding in PyErr_WarnExplicit()
Type: Stage:
Components: Interpreter Core, Unicode Versions: Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: vstinner
Priority: normal Keywords: patch

Created on 2010-12-27 02:05 by vstinner, last changed 2010-12-27 20:10 by vstinner. This issue is now closed.

Files
File name Uploaded Description Edit
warnexplicit_fsencoding.patch vstinner, 2010-12-27 02:05
Messages (2)
msg124694 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-12-27 02:05
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 #9713 and #10114 (r85569).

Attached patch fixes this issue.

See also issue #10778 (decoding_fgets() (tokenizer.c) decodes the filename from the wrong encoding).
msg124728 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-12-27 20:10
Fixed by r87517.
History
Date User Action Args
2010-12-27 20:10:53vstinnersetstatus: open -> closed

messages: + msg124728
resolution: fixed
2010-12-27 02:05:46vstinnercreate