cpython: 4243df51fe43 Lib/test/crashers/infinite_loop_re.py (original) (raw)
Mercurial > cpython
view Lib/test/crashers/infinite_loop_re.py @ 106496:4243df51fe43 default tip
Backed out changeset f23fa1f7b68fSorry, I didn't want to push this change before the review :-( I was pushing a change into the 2.7 branch.
Victor Stinner victor.stinner@gmail.com | |
---|---|
date | Fri, 10 Feb 2017 14:19:36 +0100 |
parents | c0a071df4621 |
children |
line wrap: on
line source
This was taken from http://python.org/sf/1541697[](#l2)
It's not technically a crasher. It may not even truly be infinite,
however, I haven't waited a long time to see the result. It takes
100% of CPU while running this and should be fixed.
import re
starttag = re.compile(r'<[a-zA-Z][-_.:a-zA-Z0-9]*\s*('
r'\s*([a-zA-Z_][-:.a-zA-Z_0-9]*)(\s*=\s*'
r'('[^']*'|"[^"]*"|[-a-zA-Z0-9./,:;+*%?!&$()_#=@]'
r'[][-a-zA-Z0-9./,:;+*%?!&$()_#='"@]*(?=[\s>/<])))?'
r')*\s*/?\s*(?=[<>])')
if name == 'main':
foo = '<table cellspacing="0" cellpadding="0" style="border-collapse'
starttag.match(foo)