]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport:
authorGuido van Rossum <guido@python.org>
Mon, 24 Feb 2003 01:23:03 +0000 (01:23 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 24 Feb 2003 01:23:03 +0000 (01:23 +0000)
Fix from SF patch #633359 by Greg Chapman for SF bug #610299:
    The problem is in sre_compile.py: the call to
    _compile_charset near the end of _compile_info forgets to
    pass in the flags, so that the info charset is not compiled
    with re.U. (The info charset is used when searching to find
    the first character at which a match could start; it is not
    generated for patterns beginning with a repeat like '\w{1}'.)

Lib/sre_compile.py
Lib/test/re_tests.py

index 424604bf8243891a8cdf302d2085945efadb7255..6c874761f1970c38021a945f46904a6fdcfda184 100644 (file)
@@ -399,7 +399,7 @@ def _compile_info(code, pattern, flags):
                 table[i+1] = table[table[i+1]-1]+1
         code.extend(table[1:]) # don't store first entry
     elif charset:
-        _compile_charset(charset, 0, code)
+        _compile_charset(charset, flags, code)
     code[skip] = len(code) - skip
 
 STRING_TYPES = [type("")]
index 953e4fdffe1ea9ce8f41545a7ad9572cfcbfe38e..7d7275196dd2a72367b6344f218b7036a0c05923 100755 (executable)
@@ -657,4 +657,5 @@ else:
     # bug 410271: \b broken under locales
     (r'\b.\b', 'a', SUCCEED, 'found', 'a'),
     (r'(?u)\b.\b', u, SUCCEED, 'found', u),
+    (r'(?u)\w', u, SUCCEED, 'found', u),
     ])