Message412825
> getdefaultlocale() falls back to LANG and LANGUAGE.
_Py_SetLocaleFromEnv(LC_CTYPE) (e.g. setlocale(LC_CTYPE, "")) gets called at startup, except for the isolated configuration [1].
I think calendar.Locale*Calendar should try the LC_CTYPE locale if LC_TIME is "C", i.e. (None, None). Otherwise, it's introducing new default behavior. For example, with LC_ALL set to "ru_RU.utf8":
3.8:
>>> locale.getlocale(locale.LC_TIME)
(None, None)
>>> locale.getlocale(locale.LC_CTYPE)
('ru_RU', 'UTF-8')
>>> cal = calendar.LocaleTextCalendar()
>>> cal.formatweekday(0, 15)
' Понедельник '
3.11.0a5+:
>>> locale.getlocale(locale.LC_TIME)
(None, None)
>>> locale.getlocale(locale.LC_CTYPE)
('ru_RU', 'UTF-8')
>>> cal = calendar.LocaleTextCalendar()
>>> cal.formatweekday(0, 15)
' Monday '
>>> locale.setlocale(locale.LC_TIME, '')
'ru_RU.utf8'
>>> cal = calendar.LocaleTextCalendar()
>>> cal.formatweekday(0, 15)
' Понедельник '
---
[1] https://docs.python.org/3/c-api/init_config.html?#isolated-configuration |
|
Date |
User |
Action |
Args |
2022-02-08 10:10:09 | eryksun | set | recipients:
+ eryksun, lemburg, vstinner, serhiy.storchaka |
2022-02-08 10:10:09 | eryksun | set | messageid: <1644315009.26.0.639903835602.issue46659@roundup.psfhosted.org> |
2022-02-08 10:10:09 | eryksun | link | issue46659 messages |
2022-02-08 10:10:09 | eryksun | create | |
|