[New-bugs-announce] [issue31759] re wont recover nor fail on runaway regular expression

Raphaël Riel report at bugs.python.org
Wed Oct 11 10:56:13 EDT 2017

New submission from Raphaël Riel <raphael.riel at gmail.com>:

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 -VVVV
Python 3.6.2 (default, Aug 23 2017, 14:57:08)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)]

Reproduce with attached file.

Should there be a (configurable?) limit on the number of steps involved in the process.
Or some warnings and/or hard limit that raises exception?

https://pythex.org/ will fail with a HTTP502 BadGateway (server taking too long to respond)
https://regex101.com/ python's tester seems to set a limit for this case. I can't say how they managed this.

components: Regular Expressions
files: re_backtracking.py
messages: 304146
nosy: Raphaël Riel, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: re wont recover nor fail on runaway regular expression
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47212/re_backtracking.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list