From: Brett Cannon Date: Mon, 1 Apr 2013 18:11:37 +0000 (-0400) Subject: Issue #14135: Let's try this again. X-Git-Tag: v3.4.0a1~1050 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=49e835bec60adfc98116480ca03afad772fa9959;p=python Issue #14135: Let's try this again. --- diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 45b454116f..4c55db576d 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -127,6 +127,7 @@ import builtins import faulthandler import io import json +import locale import logging import os import platform @@ -1061,7 +1062,7 @@ class saved_test_environment: 'sys.warnoptions', 'threading._dangling', 'multiprocessing.process._dangling', 'sysconfig._CONFIG_VARS', 'sysconfig._INSTALL_SCHEMES', - 'support.TESTFN', + 'support.TESTFN', 'locale', ) def get_sys_argv(self): @@ -1230,6 +1231,19 @@ class saved_test_environment: elif os.path.isdir(support.TESTFN): shutil.rmtree(support.TESTFN) + _lc = [getattr(locale, lc) for lc in dir(locale) if lc.startswith('LC_')] + def get_locale(self): + pairings = [] + for lc in self._lc: + try: + pairings.append((lc, locale.getlocale(lc))) + except TypeError: + continue + return pairings + def restore_locale(self, saved): + for lc, setting in saved: + locale.setlocale(lc, setting) + def resource_info(self): for name in self.resources: method_suffix = name.replace('.', '_')