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.

classification
Title: test_c_locale_coercion: test_PYTHONCOERCECLOCALE_set_to_one() failed on PPC64 Fedora 3.9
Type: Stage: resolved
Components: Tests Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: corona10, miss-islington, ncoghlan, vstinner
Priority: normal Keywords: patch

Created on 2020-09-03 09:40 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 22081 merged corona10, 2020-09-03 15:42
PR 22085 merged miss-islington, 2020-09-04 08:48
PR 22086 merged miss-islington, 2020-09-04 08:48
Messages (7)
msg376290 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-03 09:40
https://buildbot.python.org/all/#/builders/34/builds/16

pythoninfo:

pre_config[utf8_mode]: 1
os.environ[LANG]: C.UTF-8
sys.filesystem_encoding: utf-8/surrogateescape
sys.flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0, dev_mode=False, utf8_mode=1)

Tests logs:

0:23:06 load avg: 2.33 Re-running test_c_locale_coercion in verbose mode
skipped 'No C-with-UTF-8 locale available'
test_LC_ALL_set_to_C (test.test_c_locale_coercion.LocaleCoercionTests) ... ok
test_PYTHONCOERCECLOCALE_not_set (test.test_c_locale_coercion.LocaleCoercionTests) ... ok
test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) ... ok
test_PYTHONCOERCECLOCALE_set_to_one (test.test_c_locale_coercion.LocaleCoercionTests) ... ERROR
test_PYTHONCOERCECLOCALE_set_to_warn (test.test_c_locale_coercion.LocaleCoercionTests) ... ok
test test_c_locale_coercion failed
test_PYTHONCOERCECLOCALE_set_to_zero (test.test_c_locale_coercion.LocaleCoercionTests) ... ok

======================================================================
ERROR: test_PYTHONCOERCECLOCALE_set_to_one (test.test_c_locale_coercion.LocaleCoercionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/shager/cpython-buildarea/3.9.edelsohn-fedora-ppc64/build/Lib/test/test_c_locale_coercion.py", line 410, in test_PYTHONCOERCECLOCALE_set_to_one
    loc = locale.setlocale(locale.LC_CTYPE, "")
  File "/home/shager/cpython-buildarea/3.9.edelsohn-fedora-ppc64/build/Lib/locale.py", line 610, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

----------------------------------------------------------------------

Ran 6 tests in 3.138s

FAILED (errors=1, skipped=1)
1 test failed again:
    test_c_locale_coercion


I guess that the locale.setlocale(locale.LC_CTYPE, "") call should catch the locale.Error and skip the test if the locale is not supported.
msg376291 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-03 09:44
The test also fails on PPC64 Fedora 3.x:
https://buildbot.python.org/all/#/builders/237/builds/40

The test pass on PPC64 Fedora 3.8, the latest build still used "LANG=en_US.UTF-8":
https://buildbot.python.org/all/#/builders/163/builds/12

The test still passed on PPC64 Fedora 3.9 in build 15 which was using LANG=en_US.UTF-8:
https://buildbot.python.org/all/#/builders/34/builds/15

pythoninfo:

pre_config[utf8_mode]: 0
os.environ[LANG]: en_US.UTF-8
sys.flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0, dev_mode=False, utf8_mode=0)
sys.filesystem_encoding: utf-8/surrogateescape


So the test started to fail when the buildbot worker configured changed to use LANG=C.UTF-8.
msg376320 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-03 20:54
I can reproduce the issue with:

$ LC_ALL=xxx ./python -m test test_c_locale_coercion -m test_PYTHONCOERCECLOCALE_set_to_one -v
(...)
======================================================================
ERROR: test_PYTHONCOERCECLOCALE_set_to_one (test.test_c_locale_coercion.LocaleCoercionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/python/master/Lib/test/test_c_locale_coercion.py", line 410, in test_PYTHONCOERCECLOCALE_set_to_one
    loc = locale.setlocale(locale.LC_CTYPE, "")
  File "/home/vstinner/python/master/Lib/locale.py", line 610, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
(...)
msg376339 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-09-04 08:48
New changeset 54a66ade2067c373d31003ad260e1b7d14c81564 by Dong-hee Na in branch 'master':
bpo-41700: Skip test if the locale is not supported (GH-22081)
https://github.com/python/cpython/commit/54a66ade2067c373d31003ad260e1b7d14c81564
msg376346 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-09-04 09:55
New changeset 8f13ff959ae43fb6b8217845b2945779fe693b84 by Miss Islington (bot) in branch '3.9':
bpo-41700: Skip test if the locale is not supported (GH-22081) (GH-22085)
https://github.com/python/cpython/commit/8f13ff959ae43fb6b8217845b2945779fe693b84
msg376347 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-09-04 09:55
New changeset 4bcff52447b472bc5c8698d4ab29c09df9e122b4 by Miss Islington (bot) in branch '3.8':
bpo-41700: Skip test if the locale is not supported (GH-22081) (GH-22086)
https://github.com/python/cpython/commit/4bcff52447b472bc5c8698d4ab29c09df9e122b4
msg376352 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-09-04 10:34
This issue is fixed.
Thanks for the report and review Victor!
History
Date User Action Args
2022-04-11 14:59:35adminsetgithub: 85866
2020-09-04 10:34:18corona10setversions: + Python 3.8, Python 3.10
2020-09-04 10:34:10corona10setstatus: open -> closed
resolution: fixed
messages: + msg376352

stage: patch review -> resolved
2020-09-04 09:55:49corona10setmessages: + msg376347
2020-09-04 09:55:33corona10setmessages: + msg376346
2020-09-04 08:48:09miss-islingtonsetpull_requests: + pull_request21172
2020-09-04 08:48:03corona10setmessages: + msg376339
2020-09-04 08:48:00miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request21171
2020-09-03 20:54:38vstinnersetmessages: + msg376320
2020-09-03 15:42:02corona10setkeywords: + patch
nosy: + corona10

pull_requests: + pull_request21167
stage: patch review
2020-09-03 09:44:48vstinnersetmessages: + msg376291
2020-09-03 09:40:09vstinnercreate