]> granicus.if.org Git - python/commitdiff
make the locale_flag fallback code work again (#375)
authorBenjamin Peterson <benjamin@python.org>
Wed, 1 Mar 2017 07:59:12 +0000 (23:59 -0800)
committerGitHub <noreply@github.com>
Wed, 1 Mar 2017 07:59:12 +0000 (23:59 -0800)
Lib/test/test_re.py

index 92d2c1386de464771ce8033f37bea529d61c1190..a1953209e49b5315539c866b81966e96eddae383 100644 (file)
@@ -1400,6 +1400,8 @@ class ReTests(unittest.TestCase):
     def test_locale_flag(self):
         import locale
         enc = locale.getpreferredencoding(False)
+        bletter = None
+        bpat = b'A'
         # Search non-ASCII letter
         for i in range(128, 256):
             try:
@@ -1413,9 +1415,6 @@ class ReTests(unittest.TestCase):
                 break
             except (UnicodeError, TypeError):
                 pass
-        else:
-            bletter = None
-            bpat = b'A'
         # Bytes patterns
         pat = re.compile(bpat, re.LOCALE | re.IGNORECASE)
         if bletter: