]> granicus.if.org Git - python/commitdiff
Issue #18228: Use locale.setlocale(name, None) instead of
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 17 Jun 2013 19:28:14 +0000 (21:28 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 17 Jun 2013 19:28:14 +0000 (21:28 +0200)
locale.getlocale(name) in test.regrtest.saved_test_environment

locale.getlocale() parses the locale, which is useless for
saved_test_environment.

Lib/test/regrtest.py

index 4170ad381b73fa02bcae175c9d63572146d2bbe9..028f3b496b5a103ac4cc363e444cd91539d43cee 100755 (executable)
@@ -1232,12 +1232,12 @@ class saved_test_environment:
                 shutil.rmtree(support.TESTFN)
 
     _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):
         pairings = []
         for lc in self._lc:
             try:
-                pairings.append((lc, locale.getlocale(lc)))
+                pairings.append((lc, locale.setlocale(lc, None)))
             except (TypeError, ValueError):
                 continue
         return pairings