]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.7] bpo-29571: Fix test_re.test_locale_flag() (GH-12178)
authorVictor Stinner <vstinner@redhat.com>
Tue, 5 Mar 2019 15:17:43 +0000 (16:17 +0100)
committerGitHub <noreply@github.com>
Tue, 5 Mar 2019 15:17:43 +0000 (16:17 +0100)
commit279657bac2856039ba422c18a3d7f227b455e9d6
treecdcba3d662ea3381a289de8d9cadbc6eccb0681c
parentbf35cc2593562c24df172ce2da30303af9ad6d92
[3.7] bpo-29571: Fix test_re.test_locale_flag() (GH-12178)

Use locale.getpreferredencoding() rather than locale.getlocale() to
get the locale encoding. With some locales, locale.getlocale()
returns the wrong encoding.

For example, on Fedora 29, locale.getlocale() returns ISO-8859-1
encoding for the "en_IN" locale, whereas
locale.getpreferredencoding() reports the correct encoding: UTF-8.

On Windows, set temporarily the LC_CTYPE locale to the user preferred
encoding to ensure that it uses the ANSI code page, to be consistent
with locale.getpreferredencoding().
Lib/test/test_re.py
Misc/NEWS.d/next/Tests/2019-03-05-13-48-39.bpo-29571.ecGuKR.rst [new file with mode: 0644]