Xavier de Gaye <xdeg...@gmail.com> added the comment:

> Several of the tests in test_c_locale_coercion (particularly 
> LocaleCoercionTests._check_c_locale_coercion) tend to assume that the system 
> default locale used when setting setlocale(category, "") and when all the 
> relevant environment variables are empty/blank will be the "C"/"POSIX" locale.
>
> While this is often true POSIX does not require this to be the case.

I think you are right. The section starting with "The values of locale 
categories shall be determined by a precedence order;" in [1] states:

4. If the LANG environment variable is not set or is set to the empty string, 
the implementation-defined default locale shall be used.

In the current implementation of PR 4334 [2] only one change to 
test_c_locale_coercion is needed to fix the failures of some subtests of 
test_PYTHONCOERCECLOCALE_set_to_warn when all the locale envt variables are set 
to the empty string. All the other tests are unchanged and ok because the new 
_Py_SetLocaleFromEnv() function [3] causes Android to behave as a plain *nix 
platform except when the locale envt variables are unset or set to an empty 
string.

[1] http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html
[2] PR 4334: Fix the implementation of PEP 538 on Android
[3] And because after calling setlocale(category, "C"), setlocale(category) 
returns "C" on Android (this may not be the case on Cygwin).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32002>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to