STINNER Victor added the comment:

I wrote a PR to remove PEP 538 warnings:
https://github.com/python/cpython/pull/2186

Reference (unpatched):

haypo@selma$ env -i LC_ALL=C ./python -c "import locale; 
print(locale.getpreferredencoding())"
Python runtime initialized with LC_CTYPE=C (a locale with default ASCII 
encoding), which may cause Unicode compatibility problems. Using C.UTF-8, 
C.utf8, or UTF-8 (if available) as alternative Unicode-compatible locales is 
recommended.
ANSI_X3.4-1968

haypo@selma$ env -i LC_CTYPE=C ./python -c "import locale; 
print(locale.getpreferredencoding())"
Python detected LC_CTYPE=C: LC_CTYPE coerced to C.UTF-8 (set another locale or 
PYTHONCOERCECLOCALE=0 to disable this locale coercion behavior).
UTF-8

haypo@selma$ env -i LC_ALL=C ./python -c "import locale; 
print(locale.getpreferredencoding())"
Python runtime initialized with LC_CTYPE=C (a locale with default ASCII 
encoding), which may cause Unicode compatibility problems. Using C.UTF-8, 
C.utf8, or UTF-8 (if available) as alternative Unicode-compatible locales is 
recommended.
ANSI_X3.4-1968


With my change:

haypo@selma$ env -i ./python -c "import locale; 
print(locale.getpreferredencoding())"
UTF-8

haypo@selma$ env -i LC_CTYPE=C ./python -c "import locale; 
print(locale.getpreferredencoding())"
UTF-8

haypo@selma$ env -i LC_ALL=C ./python -c "import locale; 
print(locale.getpreferredencoding())"
ANSI_X3.4-1968

----------

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

Reply via email to