You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bpo-10466: locale.py resetlocale throws exception on Windows (getdefaultlocale returns value not usable in setlocale)
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2021-12-06.23:44:20.004>created_at=<Date2014-06-12.11:38:21.155>labels= ['build', 'library']
title='Calendar Problem with Windows (XP)'updated_at=<Date2021-12-06.23:44:20.004>user='https://bugs.python.org/Juebo'
The code is mostly correct as it exists in the calendar module. You are running into bpo-10466. Per my comment in that issue, it may be possible to put a workaround into the calendar module, but your suggestion isn't it, since your code would leave the locale modified, not restored to its value before the calendar function was called.
What happens if you replace the original setlocale call in __enter__ with a try/except, and if the set fails, redo the set call using ''? Does the save of oldlocale and its restore work in that case?
Juebo commented on Jun 12, 2014
Juebomannequin
MannequinAuthor
More actions
Yes, bpo-10466 seems to be the same problem. One could fix this one instance higher, not necessarily in Calendar.py.
As I said, I have "no idea" about Python (not yet). You could code this and I would test it.
Activity
Juebo commentedon Jun 12, 2014
I had a problem with calendar.formatmonth()
Error message was 'Unsupported Locale'
Well, it seems that Windows (XP) does nothing accept to setlocale than ''
I changed /lib/calendar.py line 488 ff to
class different_locale:
def __init__(self, locale):
self.locale = locale
Well, I am absolute new to Python. So could anybody look over it
bitdancer commentedon Jun 12, 2014
The code is mostly correct as it exists in the calendar module. You are running into bpo-10466. Per my comment in that issue, it may be possible to put a workaround into the calendar module, but your suggestion isn't it, since your code would leave the locale modified, not restored to its value before the calendar function was called.
What happens if you replace the original setlocale call in __enter__ with a try/except, and if the set fails, redo the set call using ''? Does the save of oldlocale and its restore work in that case?
Juebo commentedon Jun 12, 2014
Yes, bpo-10466 seems to be the same problem. One could fix this one instance higher, not necessarily in Calendar.py.
As I said, I have "no idea" about Python (not yet). You could code this and I would test it.