[issue31759] re wont recover nor fail on runaway regular expression

2017-10-13 Thread Matthew Barnett
Matthew Barnett added the comment: @Tim: the regex module includes some extra checks to reduce the chance of excessive backtracking. In the case of the OP's example, they seem to be working. However, it's difficult to know when adding such checks will help, and your example is one case where

[issue31759] re wont recover nor fail on runaway regular expression

2017-10-11 Thread Tim Peters
Tim Peters added the comment: Sure! The OP was obviously asking about the engine that ships with Python, so that's what I talked about. Raphaël, Matthew develops an excellent replacement ("regex") for Python's re module, which you can install via, e.g., "pip install regex" (or, on Windows,

[issue31759] re wont recover nor fail on runaway regular expression

2017-10-11 Thread Matthew Barnett
Matthew Barnett added the comment: You shouldn't assume that just because it takes a long time on one implementation that it'll take a long time on all of the others, because it's sometimes possible to include additional checks to reduce the problem. (I doubt you could eliminate the problem e

[issue31759] re wont recover nor fail on runaway regular expression

2017-10-11 Thread Raphaël Riel
Raphaël Riel added the comment: Thanks Tim! Pretty nice answer that I can learn from! Thanks for your time. I definitely knew my Regex was broken, yet I was surprised the interpreter/library didn't gave up/error after some(several million) steps. Some other language seems to just assume there

[issue31759] re wont recover nor fail on runaway regular expression

2017-10-11 Thread Tim Peters
Tim Peters added the comment: Well, the problem in the regexp is this part: "\d+,? ?". You're not _requiring_ that strings of digits be separated by a comma or blank, you're only _allowing_ them to be so separated. A solid string of digits is matched by this, and so the enclosing + require

[issue31759] re wont recover nor fail on runaway regular expression

2017-10-11 Thread Raphaël Riel
Raphaël Riel added the comment: Results for my local computer: ``` Attempting test_01 Done in 0.12ms Attempting test_02 Done in 1.52ms Attempting test_03 Done in 26.24ms Attempting test_04 Done in 432.32ms Attempting test_05 Done in 886.3ms Attempting test_06 Done in 1757.07ms Attempting test_0

[issue31759] re wont recover nor fail on runaway regular expression

2017-10-11 Thread Raphaël Riel
New submission from Raphaël Riel : re won't raise nor return when working with Runaway Regular Expression. It will compute "almost" indefinitely. Although I'm pretty sure it *may* complete sometime, it's definetly looks like it's stuck. ``` > python - Python 3.6.2 (default, Aug 23 2017, 14: