[issue28180] Implementation of the PEP 538: coerce C locale to C.utf-8

Matej Cepl report at bugs.python.org
Sat Mar 21 08:47:16 EDT 2020


Matej Cepl <mcepl at cepl.eu> added the comment:

I have tried to port this patch to Python 3.4 (still maintained by SUSE on SLE-12), but I have the hardest time to debug this. All affected tests end with errors like this:

[  493s] ======================================================================
[  493s] FAIL: test_test_PYTHONCOERCECLOCALE_not_set (test.test_c_locale_coercion.LocaleCoercionTests) (PYTHONCOERCECLOCALE=None, env_var='LC_CTYPE', nominal_locale='invalid.ascii')
[  493s] ----------------------------------------------------------------------
[  493s] Traceback (most recent call last):
[  493s]   File "/home/abuild/rpmbuild/BUILD/Python-3.4.10/Lib/test/test_c_locale_coercion.py", line 326, in _check_c_locale_coercion
[  493s]     coercion_expected)
[  493s]   File "/home/abuild/rpmbuild/BUILD/Python-3.4.10/Lib/test/test_c_locale_coercion.py", line 219, in _check_child_encoding_details
[  493s]     self.assertEqual(encoding_details, expected_details)
[  493s] AssertionError: {'fse[79 chars]cii:strict', 'stderr_info': 'ascii:backslashre[45 chars]ict'} != {'fse[79 chars]cii:surrogateescape', 'stderr_info': 'ascii:ba[63 chars]ape'}
[  493s]   {'fsencoding': 'ascii',
[  493s]    'lang': '',
[  493s]    'lc_all': '',
[  493s]    'lc_ctype': 'invalid.ascii',
[  493s]    'stderr_info': 'ascii:backslashreplace',
[  493s] -  'stdin_info': 'ascii:strict',
[  493s] ?                         ^^ ^
[  493s] 
[  493s] +  'stdin_info': 'ascii:surrogateescape',
[  493s] ?                        ++++++ ^^^ ^^^
[  493s] 
[  493s] -  'stdout_info': 'ascii:strict'}
[  493s] ?                          ^^ ^
[  493s] 
[  493s] +  'stdout_info': 'ascii:surrogateescape'}
[  493s] ?                         ++++++ ^^^ ^^^

yes, it is always a conflict between strict and surrogateescape. I probably don’t have time to finish debugging this, so I am just leaving this for posterity.

----------
nosy: +mcepl
Added file: https://bugs.python.org/file48991/pep538_coerce_legacy_c_locale.patch

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


More information about the Python-bugs-list mailing list