Message316045
observing a behaviour on Python 3.7 b2 that doesn't match what's documented in PEP 538
PEP 538 states that the locale coercion behaviour can be disabled through the PYTHONCOERCECLOCALE environment variable.
I would then expect the stdin encoding to be the same as Python 3.6 when the C locale is specified with no encoding value.
bash-3.2$ LANG=C python3.6 -c "import sys; print(sys.stdin.encoding)"
US-ASCII
bash-3.2$ LANG=C python3.7 -c "import sys; print(sys.stdin.encoding)"
utf-8
bash-3.2$ PYTHONCOERCECLOCALE=0 LANG=C python3.7 -c "import sys; print(sys.stdin.encoding)"
utf-8
LC_ALL is not set
bash-3.2$ locale
LANG="C"
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
Trying to dig into the reason why the env flag isn't disabling the behaviour I found some subsequent changes after the PEP which look to have broken the original implementation behaviour.
https://github.com/python/cpython/commit/9454060e84a669dde63824d9e2fcaf295e34f687 |
|
Date |
User |
Action |
Args |
2018-05-02 06:18:14 | anthony shaw | set | recipients:
+ anthony shaw |
2018-05-02 06:18:14 | anthony shaw | set | messageid: <1525241894.06.0.682650639539.issue33405@psf.upfronthosting.co.za> |
2018-05-02 06:18:14 | anthony shaw | link | issue33405 messages |
2018-05-02 06:18:13 | anthony shaw | create | |
|