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 <1274225225.11.0.473683675376.issue8589@psf.upfronthosting.co.za>
In-reply-to
Content
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/test_warnings.py instead of using "Lib/test/regrtest.py -v test_warnings". I only patched regrtest.py to use backslashreplace error handler on sys.stdout.
History
Date User Action Args
2010-05-18 23:27:05vstinnersetrecipients: + vstinner, brett.cannon, r.david.murray, michael.foord
2010-05-18 23:27:05vstinnersetmessageid: <1274225225.11.0.473683675376.issue8589@psf.upfronthosting.co.za>
2010-05-18 23:27:01vstinnerlinkissue8589 messages
2010-05-18 23:27:00vstinnercreate