Commit 64c3e70d authored by Victor Stinner's avatar Victor Stinner

Issue #18228: Use locale.setlocale(name, None) instead of

locale.getlocale(name) in test.regrtest.saved_test_environment

locale.getlocale() parses the locale, which is useless for
saved_test_environment.
parent 617473cd
...@@ -1232,12 +1232,12 @@ class saved_test_environment: ...@@ -1232,12 +1232,12 @@ class saved_test_environment:
shutil.rmtree(support.TESTFN) shutil.rmtree(support.TESTFN)
_lc = [getattr(locale, lc) for lc in dir(locale) _lc = [getattr(locale, lc) for lc in dir(locale)
if lc.startswith('LC_') and lc != 'LC_ALL'] if lc.startswith('LC_')]
def get_locale(self): def get_locale(self):
pairings = [] pairings = []
for lc in self._lc: for lc in self._lc:
try: try:
pairings.append((lc, locale.getlocale(lc))) pairings.append((lc, locale.setlocale(lc, None)))
except (TypeError, ValueError): except (TypeError, ValueError):
continue continue
return pairings return pairings
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment