You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FreeBSD: Fatal Python error: get_locale_encoding: failed to get the locale encoding: nl_langinfo(CODESET) failed #78725
bpo-34485, Windows: LC_CTYPE set to user preference (GH-8988)
On Windows, the LC_CTYPE is now set to the user preferred locale at
startup: _Py_SetLocaleFromEnv(LC_CTYPE) is now called during the
Python initialization. Previously, the LC_CTYPE locale was "C" at
startup, but changed when calling setlocale(LC_CTYPE, "") or
setlocale(LC_ALL, "").
pymain_read_conf() now also calls _Py_SetLocaleFromEnv(LC_CTYPE) to
behave as _Py_InitializeCore(). Moreover, it doesn't save/restore the
LC_ALL anymore.
On Windows, standard streams like sys.stdout now always use
surrogateescape error handler by default (ignore the locale).
test_c_locale_coerce tests invalid locales like LANG="invalid.ascii". It seems like Python supported such configuration before my changes.
Activity
vstinner commentedon Aug 29, 2018
It seems like my recent work on Python initialization broke Python on FreeBSD. Many test_c_locale_coerce tests now fail with:
"Fatal Python error: get_locale_encoding: failed to get the locale encoding: nl_langinfo(CODESET) failed"
Example of failed buildbot build:
https://buildbot.python.org/all/#/builders/87/builds/1340
It seems like this buildbot started to fail at this build:
https://buildbot.python.org/all/#/builders/87/builds/1332
This build has been triggered by this change:
commit 177d921
Author: Victor Stinner <vstinner@redhat.com>
Date: Wed Aug 29 11:25:15 2018 +0200
test_c_locale_coerce tests invalid locales like LANG="invalid.ascii". It seems like Python supported such configuration before my changes.
My recent work:
vstinner commentedon Aug 30, 2018
I cannot reproduce the issue on my FreeBSD 11.1 VM. I cannot reproduce the issue on Koobs's "CURRENT-amd64%" buildbot neither :-(
Example:
CURRENT-amd64% env -i LC_ALL=invalid LC_CTYPE=invalid LANG=invalid PYTHONUTF8=0 PYTHONCOERCECLOCALE=0 ./python -X utf8=0 -c pass
(no error)
vstinner commentedon Sep 3, 2018
New changeset f01b2a1 by Victor Stinner in branch 'master':
bpo-34544: Fix setlocale() in pymain_read_conf() (GH-9041)
f01b2a1
vstinner commentedon Sep 3, 2018
My fix didn't work :-(
https://buildbot.python.org/all/#/builders/87/builds/1355
...
Fatal Python error: get_locale_encoding: failed to get the locale encoding: nl_langinfo(CODESET) failed
...
vstinner commentedon Sep 3, 2018
New changeset 8ea0911 by Victor Stinner in branch 'master':
_Py_CoerceLegacyLocale() restores LC_CTYPE on fail (GH-9044)
8ea0911
vstinner commentedon Sep 3, 2018
New changeset 73b00be by Victor Stinner in branch 'master':
bpo-34544: pymain_read_conf() don't change LC_ALL (GH-9045)
73b00be
vstinner commentedon Sep 3, 2018
New changeset 84b0129 by Victor Stinner in branch '3.7':
_Py_CoerceLegacyLocale() restores LC_CTYPE on fail (GH-9044) (GH-9046)
84b0129
vstinner commentedon Sep 3, 2018
test_c_locale_coerce pass again on AMD64 FreeBSD 10.x Shared 3.x, I close the issue.