Kaydet (Commit) 19f977ba authored tarafından Fredrik Lundh's avatar Fredrik Lundh

- don't hang if group id is followed by whitespace (closes bug #114660)

üst 96753b34
......@@ -634,7 +634,7 @@ def parse_template(source, pattern):
while 1:
group = _group(this, pattern.groups+1)
if group:
if (not s.next or
if (s.next not in DIGITS or
not _group(this + s.next, pattern.groups+1)):
code = MARK, int(group)
break
......
#!/usr/bin/env python
# -*- mode: python -*-
# $Id$
# Re test suite and benchmark suite v1.5
......
......@@ -114,6 +114,9 @@ test(r"""sre.sub(r'^\s*', 'X', 'test')""", 'Xtest')
test(r"""sre.sub(r'a', 'b', 'aaaaa')""", 'bbbbb')
test(r"""sre.sub(r'a', 'b', 'aaaaa', 1)""", 'baaaa')
# bug 114660
test(r"""sre.sub(r'(\S)\s+(\S)', r'\1 \2', 'hello there')""", 'hello there')
if verbose:
print 'Running tests on symbolic references'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment