New submission from STINNER Victor <victor.stin...@haypocalc.com>:

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).

----------
components: Interpreter Core, Unicode
files: warnexplicit_fsencoding.patch
keywords: patch
messages: 124694
nosy: haypo
priority: normal
severity: normal
status: open
title: Change filename encoding to FS encoding in PyErr_WarnExplicit()
versions: Python 3.2
Added file: http://bugs.python.org/file20170/warnexplicit_fsencoding.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10779>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to