Merged revisions 85728 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85728 | georg.brandl | 2010-10-19 20:54:25 +0200 (Di, 19 Okt 2010) | 1 line
#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.
........
diff --git a/Lib/calendar.py b/Lib/calendar.py
index a8735b9..3106ef2 100644
--- a/Lib/calendar.py
+++ b/Lib/calendar.py
@@ -486,8 +486,8 @@
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)