Commits

Anonymous committed 628dcf9

Restore the locale to "C" on exit.

If this doesn't happen, it leaves the locale in a state that can cause
other tests to fail. For example, running test_strptime,
test_logging, and test_time in that order.

Comments (0)

Files changed (1)

Lib/test/test_logging.py

 import logging, logging.handlers, logging.config
 
 try:
-    locale.setlocale(locale.LC_ALL, '')
+    cur_locale = locale.setlocale(locale.LC_ALL, '')
 except (ValueError, locale.Error):
     # this happens on a Solaris box which only supports "C" locale
     # or a Mac OS X box which supports very little locale stuff at all
-    pass
+    cur_locale = None
 
 BANNER = "-- %-10s %-6s ---------------------------------------------------\n"
 
         banner("logrecv output", "end")
         sys.stdout.flush()
 
+    if cur_locale:
+        locale.setlocale(locale.LC_ALL, "C")
+
 if __name__ == "__main__":
     sys.stdout.write("test_logging\n")
     test_main()