summaryrefslogtreecommitdiffstats
path: root/Lib/calendar.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-10-19 18:54:25 (GMT)
committerGeorg Brandl <georg@python.org>2010-10-19 18:54:25 (GMT)
commit7004bd1a3de06330761d164bae0d82c597bf39cf (patch)
tree4c27a09a59a559026e5f1cf157df2573fbdb9304 /Lib/calendar.py
parentf87cc0448158fedad9ba0a1edcec3664d9f90eb4 (diff)
downloadcpython-7004bd1a3de06330761d164bae0d82c597bf39cf.zip
cpython-7004bd1a3de06330761d164bae0d82c597bf39cf.tar.gz
cpython-7004bd1a3de06330761d164bae0d82c597bf39cf.tar.bz2
#10092: Properly reset locale in Locale*Calendar classes. The context manager was buggy because setlocale() returns the *new* locale, not the old. Also add a test for this.
Diffstat (limited to 'Lib/calendar.py')
-rw-r--r--Lib/calendar.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/calendar.py b/Lib/calendar.py
index 12bd1a8..84aa3a4 100644
--- a/Lib/calendar.py
+++ b/Lib/calendar.py
@@ -486,8 +486,8 @@ class different_locale:
self.locale = locale
def __enter__(self):
- self.oldlocale = _locale.setlocale(_locale.LC_TIME, self.locale)
- #return _locale.getlocale(_locale.LC_TIME)[1]
+ self.oldlocale = _locale.getlocale(_locale.LC_TIME)
+ _locale.setlocale(_locale.LC_TIME, self.locale)
def __exit__(self, *args):
_locale.setlocale(_locale.LC_TIME, self.oldlocale)