This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2018-09-11.23:47:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I modified Py_Main() to ignore the PYTHONCOERCECLOCALE environment variable if -E or -I command line option is used. But Nick asks to always read PYTHONCOERCECLOCALE.

We should either update the PEP or change the code.

I am not sure why PYTHONCOERCECLOCALE should be handled differently than other PYTHON* variable like PYTHONWARNINGS or PYTHONUTF8. Is it because it impacts the encodings? Is it because there was a chicken-and-egg issue before I reworked Py_Main() code? (PYTHONCOERCECLOCALE env var was read before reading command line arguments.)


Copy of Nick Coghlan's msg325009:

(The one exception to "nothing gets decoded incorrectly" is that PYTHONCOERCECLOCALE itself is always interpreted as an ASCII field: the values that it checks for are actually ASCII byte sequences, not Unicode code points.

The documentation could definitely be much clearer on that point though, as even in the PEP it's only implied by the final paragraph in which is mostly talking about the fact that this particular environment variable is still checked, even if you pass the -I or -E command line options.
Date User Action Args
2018-09-11 23:47:42vstinnersetrecipients: + vstinner
2018-09-11 23:47:42vstinnersetmessageid: <>
2018-09-11 23:47:42vstinnerlinkissue34639 messages
2018-09-11 23:47:42vstinnercreate