[docs] [issue33934] locale.getlocale() seems wrong when the locale is yet unset (python3 on linux)

Nick Coghlan report at bugs.python.org
Sat Jun 23 23:29:06 EDT 2018


Nick Coghlan <ncoghlan at gmail.com> added the comment:

This statement is no longer correct: "when python starts, it runs using the C locale, on any platform (Windows, Linux, BSD), any python version (2, 3...), until locale.setlocale() is used to set another locale."

The Python 3 text model doesn't work properly in the legacy C locale due to the assumption of ASCII as the preferred text encoding, so we run setlocale(LC_ALL, "") early in the startup sequence in order to switch to something more sensible. In Python 3.7+, we're even more opinionated about that, and explicitly coerce the C locale to a UTF-8 based one if there's one available.

If our docs are still saying otherwise anywhere, then our docs are outdated, and need to be fixed.

----------
assignee:  -> docs at python
components: +Documentation -Library (Lib)
nosy: +docs at python
stage:  -> needs patch

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33934>
_______________________________________


More information about the docs mailing list