Author AndersMunch
Recipients AndersMunch, paul.moore, steve.dower, swt2c, tim.golden, zach.ware
Date 2021-02-17.09:55:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1613555738.14.0.398836728759.issue43115@roundup.psfhosted.org>
In-reply-to
Content
I discovered that this can happen with underscores as well:

Python 3.8.7 (tags/v3.8.7:6503f05, Dec 21 2020, 17:59:51) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_ALL, 'en_DE')
'en_DE'
>>> locale.getlocale()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\flonidan\env\Python38-64\lib\locale.py", line 591, in getlocale
    return _parse_localename(localename)
  File "C:\flonidan\env\Python38-64\lib\locale.py", line 499, in _parse_localename
    raise ValueError('unknown locale: %s' % localename)
ValueError: unknown locale: en_DE

locale.setlocale does validate input - if you write nonsense in the second argument then you get an exception, "locale.Error: unsupported locale setting".  So I'm guessing the en_DE locale is actually being set here, and the problem is solely about getlocale making unfounded assumptions about the format.

Same thing happens in 3.10.0a4.
History
Date User Action Args
2021-02-17 09:55:38AndersMunchsetrecipients: + AndersMunch, paul.moore, tim.golden, zach.ware, steve.dower, swt2c
2021-02-17 09:55:38AndersMunchsetmessageid: <1613555738.14.0.398836728759.issue43115@roundup.psfhosted.org>
2021-02-17 09:55:38AndersMunchlinkissue43115 messages
2021-02-17 09:55:37AndersMunchcreate