#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 12bd1a8..84aa3a4 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)