New submission from Gabriel Rodríguez Alberich:

>>> import re
>>> re.compile("(?P<>)")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/re.py", line 190, in compile
    return _compile(pattern, flags)
  File "/usr/lib/python2.7/re.py", line 240, in _compile
    p = sre_compile.compile(pattern, flags)
  File "/usr/lib/python2.7/sre_compile.py", line 500, in compile
    p = sre_parse.parse(p, flags)
  File "/usr/lib/python2.7/sre_parse.py", line 673, in parse
    p = _parse_sub(source, pattern, 0)
  File "/usr/lib/python2.7/sre_parse.py", line 308, in _parse_sub
    itemsappend(_parse(source, state))
  File "/usr/lib/python2.7/sre_parse.py", line 544, in _parse
    if not isname(name):
  File "/usr/lib/python2.7/sre_parse.py", line 218, in isname
    if not isident(name[0]):
IndexError: string index out of range

isname() shouldn't be blindly accessing name[0].

----------
components: Regular Expressions
messages: 176664
nosy: Gabriel.Rodríguez.Alberich, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: Regular expressions with empty named groups breaks isname check
type: crash
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16578>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to