Issue #17998: Fix an internal error in regular expression engine.

This commit is contained in:
Serhiy Storchaka 2013-08-03 19:18:38 +03:00
parent 1dfb9180a7
commit 1f35ae0a3c
4 changed files with 19 additions and 7 deletions

View file

@ -1040,6 +1040,16 @@ class ReTests(unittest.TestCase):
with self.assertRaisesRegex(sre_constants.error, '\?foo'):
re.compile('(?P<?foo>)')
def test_issue17998(self):
for reps in '*', '+', '?', '{1}':
for mod in '', '?':
pattern = '.' + reps + mod + 'yz'
self.assertEqual(re.compile(pattern, re.S).findall('xyz'),
['xyz'], msg=pattern)
pattern = pattern.encode()
self.assertEqual(re.compile(pattern, re.S).findall(b'xyz'),
[b'xyz'], msg=pattern)
def run_re_tests():
from test.re_tests import tests, SUCCEED, FAIL, SYNTAX_ERROR