Author vstinner
Recipients brett.cannon, michael.foord, r.david.murray, vstinner
Date 2010-05-18.23:26:59
SpamBayes Score 1.26357e-05
Marked as misclassified No
Message-id <>
Attached patch creates PySys_AddWarnOptionUnicode() function and decodes PYTHONWARNINGS variable with the file system encoding (as it is done for os.environ, to be consistent) instead of the locale encoding.

The patch only concerns the POSIX version. Windows is not affected by this issue (see below).


This issue occurs if the file system encoding is different than the locale encoding (especially if the locale encoding is ASCII). It only occurs on Mac OS because on this OS, the file system encoding is hardcoded to UTF-8 whereas the locale encoding... depends on the locale.

I reproduced the bug on Linux by hardcoding the file system encoding to UTF-8.


About the test output (UnicodeEncodeError: 'ascii' codec can't encode character '\xf3' ...): I think that Michael Foord executed directly Lib/test/ instead of using "Lib/test/ -v test_warnings". I only patched to use backslashreplace error handler on sys.stdout.
Date User Action Args
2010-05-18 23:27:05vstinnersetrecipients: + vstinner, brett.cannon, r.david.murray, michael.foord
2010-05-18 23:27:05vstinnersetmessageid: <>
2010-05-18 23:27:01vstinnerlinkissue8589 messages
2010-05-18 23:27:00vstinnercreate