Jacques Grove <[email protected]> added the comment:
Here's one that really falls in the category of "don't do that"; but I found
this because I was limiting the system recursion level to somewhat less than
the standard 1000 (for other reasons), and I had some shorter duplicate
patterns in a big regex. Here is the simplest case to make it blow up with the
standard recursion settings:
$ cat test.py
import re, regex
regexp =
'(abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ|abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ)'
re.compile(regexp)
regex.compile(regexp)
$ python test.py
<snip big traceback except for last few lines>
File "/tmp/test/src/lib/_regex_core.py", line 2024, in optimise
subpattern = subpattern.optimise(info)
File "/tmp/test/src/lib/_regex_core.py", line 1552, in optimise
branches = [_Branch(branches)]
RuntimeError: maximum recursion depth exceeded
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue2636>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com