summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/sre_parse.py4
-rwxr-xr-xLib/test/re_tests.py10
-rw-r--r--Lib/test/test_sre.py2
3 files changed, 11 insertions, 5 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py
index 7313a1f..f6b53de 100644
--- a/Lib/sre_parse.py
+++ b/Lib/sre_parse.py
@@ -83,8 +83,8 @@ class Pattern:
if name:
ogid = self.groupdict.get(name, None)
if ogid is not None:
- raise error, ("redefinition of group name %s as group %d; " +
- "was group %d") % (`name`, gid, ogid)
+ raise error, ("redefinition of group name %s as group %d; "
+ "was group %d" % (repr(name), gid, ogid))
self.groupdict[name] = gid
self.open.append(gid)
return gid
diff --git a/Lib/test/re_tests.py b/Lib/test/re_tests.py
index d69b324..953e4fd 100755
--- a/Lib/test/re_tests.py
+++ b/Lib/test/re_tests.py
@@ -638,8 +638,14 @@ xyzabc
(r'(?i)[m]+', 'MMM', SUCCEED, 'found', 'MMM'),
# bug 130748: ^* should be an error (nothing to repeat)
(r'^*', '', SYNTAX_ERROR),
- # bug 133283: minimizing repeat bug
- (r'"(?:\\"|[^"])*?"', r'"\""', SUCCEED, 'found', r'"\"'),
+ # bug 133283: minimizing repeat problem
+ (r'"(?:\\"|[^"])*?"', r'"\""', SUCCEED, 'found', r'"\""'),
+ # bug 477728: minimizing repeat problem
+ (r'^.*?$', 'one\ntwo\nthree\n', FAIL),
+ # bug 483789: minimizing repeat problem
+ (r'a[^>]*?b', 'a>b', FAIL),
+ # bug 490573: minimizing repeat problem
+ (r'^a*?$', 'foo', FAIL),
]
try:
diff --git a/Lib/test/test_sre.py b/Lib/test/test_sre.py
index 6442036..abd55db 100644
--- a/Lib/test/test_sre.py
+++ b/Lib/test/test_sre.py
@@ -296,7 +296,7 @@ if verbose:
# implementation of repeated groups.
test("sre.match('(x)*', 50000*'x').span()", (0, 50000), RuntimeError)
test("sre.match(r'(x)*y', 50000*'x'+'y').span()", (0, 50001), RuntimeError)
-test("sre.match(r'(x)*?y', 50000*'x'+'y').span()", (0, 50001))
+test("sre.match(r'(x)*?y', 50000*'x'+'y').span()", (0, 50001), RuntimeError)
from re_tests import *