R. David Murray added the comment: The code is mostly correct as it exists in the calendar module. You are running into issue 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? ---------- nosy: +r.david.murray _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21731> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com