diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/sre_parse.py | 3 | ||||
-rw-r--r-- | Lib/test/test_re.py | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index 33b399e..319bf43 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -485,6 +485,9 @@ def _parse(source, state): elif this == "+": min, max = 1, MAXREPEAT elif this == "{": + if source.next == "}": + subpatternappend((LITERAL, ord(this))) + continue here = source.tell() min, max = 0, MAXREPEAT lo = hi = "" diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index eab995d..9755005 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -297,6 +297,9 @@ class ReTests(unittest.TestCase): self.assertNotEqual(re.match("^x{1,4}?$", "xxx"), None) self.assertNotEqual(re.match("^x{3,4}?$", "xxx"), None) + self.assertEqual(re.match("^x{}$", "xxx"), None) + self.assertNotEqual(re.match("^x{}$", "x{}"), None) + def test_getattr(self): self.assertEqual(re.match("(a)", "a").pos, 0) self.assertEqual(re.match("(a)", "a").endpos, 1) |