[issue33934] locale.getlocale() seems wrong when the locale is yet unset (python3 on linux)
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Nick Coghlan <ncoghlan@gmail.com> added the comment: Ah, part of the confusion is that I misremembered the command we run implicitly during startup - it's only `setlocale(LC_CTYPE, "")`, not `setlocale(LC_ALL, "")`. However, the default category for `locale.getlocale()` is `LC_CTYPE`, so it reports the text encoding locale configured during startup, not the C level default. The difference on Windows is expected - the startup code that implicitly runs `setlocale(LC_CTYPE, "")` doesn't get compiled in there. So I think we have a few different potential ways of viewing this bug report: 1. As a docs issue, where we advise users to run `locale.getlocale(locale.LC_MESSAGES)` to find out whether or not a specific locale really has been configured (vs the interpreter's default text encoding change that runs implicitly on startup) 2. As a defaults change for 3.8+, where we switch `locale.getlocale()` over to checking `locale.LC_MESSAGES` instead of `locale.LC_CTYPES`, since the interpreter always sets the latter on startup, so it doesn't convey much useful information. 3. As (1) for maintenance releases, and as (2) for 3.8+ ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33934> _______________________________________
participants (1)
-
Nick Coghlan