diff -r 91a7b9c3ef9b Lib/test/regrtest.py --- a/Lib/test/regrtest.py Mon Apr 01 13:26:21 2013 -0400 +++ b/Lib/test/regrtest.py Mon Apr 01 13:46:01 2013 -0400 @@ -127,6 +127,7 @@ import faulthandler import io import json +import locale import logging import os import platform @@ -1061,7 +1062,7 @@ '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 @@ 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('.', '_')