[issue38324] [Windows] test_locale and test__locale failures on Windows

Eryk Sun report at bugs.python.org
Tue Feb 11 14:36:49 EST 2020


Eryk Sun <eryksun at gmail.com> added the comment:

It is not a duplicate of bpo-37945. The tests in test/test__locale.py need to be fixed to work with Windows. 

In msg354021, I discussed the problem reported with test_lc_numeric_localeconv. The "ps_AF" (Pashto, Afghanistan) item in known_numerics has to be skipped in Windows because the system data does not agree with the test's assumed Arabic decimal and thousands separator, U+066B and U+066C, but instead uses "," and ".".
  
Also, all tests need to swap the order of setting LC_NUMERIC and LC_CTYPE in order to avoid a UnicodeDecodeError with locales that use UTF-8, such as "ka_GE". _locale.localeconv should be using the wide-character_W_ prefixed string fields from the lconv structure in Windows [1], such as _W_decimal_point. Until that gets fixed, tests need to be mindful that ucrt in Windows uses the current LC_CTYPE to update the multibyte strings in the lconv structure when setting LC_NUMERIC. So they should be changed as a pair, with LC_CTYPE set first.

[1]: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/localeconv?view=vs-2019

----------
resolution: duplicate -> 
stage: resolved -> needs patch
status: closed -> open
superseder: [Windows] locale.getdefaultlocale() issues on Windows: test_locale.test_getsetlocale_issue1813() -> 
type:  -> behavior

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


More information about the Python-bugs-list mailing list