homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dgallion
Recipients
Date 2000年09月23日.04:12:52
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
This pattern fails with sre:
>>> re.match("(?s){.*?}","{"+' '*17000+"}")
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
 File "E:\pythonWinCVS\python\dist\src\lib\sre.py", line 44, in match
 return _compile(pattern, flags).match(string)
RuntimeError: maximum recursion limit exceeded
The same pattern with even a much larger search buffer works fine on 1.52
This patch optimizes the case ".*?" and avoids the recursion limit.
After the patch:
>>> import re
>>> re.findall('ab.*?bc', 'abababbc')
['abababbc']
>>> re.findall('ab??bc', 'abababbc')
['abbc']
>>> re.sub("(?s){.*?}","","{"+' '*19047+"}")
''
>>> re.match("(?s){.*?}","{"+' '*16048+"}")
<SRE_Match object at 007E4490>
>>> import test.test_re
Running tests on re.search and re.match
Running tests on re.sub
Running tests on symbolic references
Running tests on re.subn
Running tests on re.split
Running tests on re.findall
Running tests on re.match
Running tests on re.escape
Pickling a RegexObject instance
Test engine limitations
maximum recursion limit exceeded
Running re_tests test suite
>>>
History
Date User Action Args
2007年08月23日 15:02:00adminlinkissue401612 messages
2007年08月23日 15:02:00admincreate

AltStyle によって変換されたページ (->オリジナル) /