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 mark.dickinson
Recipients Zectbumo, eric.smith, mark.dickinson, steven.daprano
Date 2019-12-17.21:48:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1576619312.81.0.186811397237.issue39079@roundup.psfhosted.org>
In-reply-to
Content
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'
History
Date User Action Args
2019-12-17 21:48:32mark.dickinsonsetrecipients: + mark.dickinson, eric.smith, steven.daprano, Zectbumo
2019-12-17 21:48:32mark.dickinsonsetmessageid: <1576619312.81.0.186811397237.issue39079@roundup.psfhosted.org>
2019-12-17 21:48:32mark.dickinsonlinkissue39079 messages
2019-12-17 21:48:32mark.dickinsoncreate