Mark Dickinson <[email protected]> added the comment:
For completeness, here's the path leading to the reassignment (after hacking in
a raise to the appropriate place in _localemodule.c). It's a side-effect of
calling `locale.getpreferredencoding`.
>>> help(int)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/mdickinson/GitHub/python/cpython/Lib/site.py", line 445, in
__call__
import pydoc
File "/Users/mdickinson/GitHub/python/cpython/Lib/pydoc.py", line 202, in
<module>
_encoding = locale.getpreferredencoding()
File "/Users/mdickinson/GitHub/python/cpython/Lib/locale.py", line 616, in
getpreferredencoding
setlocale(LC_CTYPE, "")
File "/Users/mdickinson/GitHub/python/cpython/Lib/locale.py", line 581, in
setlocale
return _setlocale(category, locale)
ValueError: about to reassign string.letters
So a minimal reproducer is something like:
Python 2.7.17 (default, Oct 20 2019, 14:46:50)
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import string, locale
>>> string.letters
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
>>> locale.getpreferredencoding()
'UTF-8'
>>> string.letters
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39079>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com