[New-bugs-announce] [issue33566] re.findall() dead locked whent the expected ending char not occur until end of string

Min report at bugs.python.org
Fri May 18 04:06:05 EDT 2018


New submission from Min <mamamiaibm at gmail.com>:

Firstly, I wrote something like this:

patn = r"\bROW\s*\((\d+|\*)\)(.|\s)*?\)"
    newlines = re.sub(patn, "\nYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY\n", newlines)
but if the file(or string) ended without the expected ")" the code deadlock there, no progress, no exception, and no exit.

Then I changed it to :
 patn = r"\bROW\s*\((\d+|\*)\)(.|\s)*?(\)|$)"
    newlines = re.sub(patn, "\nYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY\n", newlines) to enforce the rule of  end of file. then everything ok.

I felt this is a but, coz RE should not die, it should exit if can't match.

it is Py3.5 on ubuntu. Thanks!

----------
messages: 317013
nosy: mamamiaibm
priority: normal
severity: normal
status: open
title: re.findall() dead locked whent the expected ending char not occur until end of string
type: behavior
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33566>
_______________________________________


More information about the New-bugs-announce mailing list