New submission from Min <mamamia...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue33566>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to