This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xdegaye
Recipients erik.bray, ncoghlan, xdegaye
Date 2017-11-11.12:57:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1510405046.7.0.213398074469.issue32002@psf.upfronthosting.co.za>
In-reply-to
Content
> 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).
History
Date User Action Args
2017-11-11 12:57:26xdegayesetrecipients: + xdegaye, ncoghlan, erik.bray
2017-11-11 12:57:26xdegayesetmessageid: <1510405046.7.0.213398074469.issue32002@psf.upfronthosting.co.za>
2017-11-11 12:57:26xdegayelinkissue32002 messages
2017-11-11 12:57:26xdegayecreate