mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #14135: Let's try this again.
This commit is contained in:
parent
a495b498af
commit
49e835bec6
1 changed files with 15 additions and 1 deletions
|
@ -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('.', '_')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue