bpo-46659: test.support avoids locale.getdefaultlocale() (GH-31167)

skip_if_buggy_ucrt_strfptime() of test.support now uses
locale.getpreferredencoding(False) instead of
locale.getdefaultlocale() to get the Windows code page.
This commit is contained in:
Victor Stinner 2022-02-06 21:51:56 +01:00 committed by GitHub
parent 04dd60e50c
commit 06b8f1615b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1421,7 +1421,7 @@ def skip_if_buggy_ucrt_strfptime(test):
global _buggy_ucrt global _buggy_ucrt
if _buggy_ucrt is None: if _buggy_ucrt is None:
if(sys.platform == 'win32' and if(sys.platform == 'win32' and
locale.getdefaultlocale()[1] == 'cp65001' and locale.getpreferredencoding(False) == 'cp65001' and
time.localtime().tm_zone == ''): time.localtime().tm_zone == ''):
_buggy_ucrt = True _buggy_ucrt = True
else: else: