PageRenderTime 37ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/lib-python/2.7/test/crashers/infinite_loop_re.py

https://bitbucket.org/yrttyr/pypy
Python | 16 lines | 9 code | 3 blank | 4 comment | 1 complexity | c0a1c8b32c1a7b07f7749b73b23fcaa2 MD5 | raw file
  1. # This was taken from http://python.org/sf/1541697
  2. # It's not technically a crasher. It may not even truly be infinite,
  3. # however, I haven't waited a long time to see the result. It takes
  4. # 100% of CPU while running this and should be fixed.
  5. import re
  6. starttag = re.compile(r'<[a-zA-Z][-_.:a-zA-Z0-9]*\s*('
  7. r'\s*([a-zA-Z_][-:.a-zA-Z_0-9]*)(\s*=\s*'
  8. r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./,:;+*%?!&$\(\)_#=~@]'
  9. r'[][\-a-zA-Z0-9./,:;+*%?!&$\(\)_#=~\'"@]*(?=[\s>/<])))?'
  10. r')*\s*/?\s*(?=[<>])')
  11. if __name__ == '__main__':
  12. foo = '<table cellspacing="0" cellpadding="0" style="border-collapse'
  13. starttag.match(foo)