This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: In module re the repeat interval {} doesn't accept numbers greater than 65535
Type: behavior Stage:
Components: Library (Lib), Regular Expressions Versions: Python 3.2
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, py.user, vstinner
Priority: normal Keywords:

Created on 2012-01-31 21:45 by py.user, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg152409 - (view) Author: py.user (py.user) * Date: 2012-01-31 21:45
>>> import re
>>> len(re.search(r'a+', 'a' * 100000).group())
100000
>>>
>>> re.search(r'a{65536,}', 'a' * 100000)
Traceback (most recent call last):
  File "/usr/local/lib/python3.2/functools.py", line 176, in wrapper
    result = cache[key]
KeyError: (<class 'str'>, 'a{65536,}', 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.2/re.py", line 158, in search
    return _compile(pattern, flags).search(string)
  File "/usr/local/lib/python3.2/re.py", line 255, in _compile
    return _compile_typed(type(pattern), pattern, flags)
  File "/usr/local/lib/python3.2/functools.py", line 180, in wrapper
    result = user_function(*args, **kwds)
  File "/usr/local/lib/python3.2/re.py", line 267, in _compile_typed
    return sre_compile.compile(pattern, flags)
  File "/usr/local/lib/python3.2/sre_compile.py", line 491, in compile
    p = sre_parse.parse(p, flags)
  File "/usr/local/lib/python3.2/sre_parse.py", line 692, in parse
    p = _parse_sub(source, pattern, 0)
  File "/usr/local/lib/python3.2/sre_parse.py", line 315, in _parse_sub
    itemsappend(_parse(source, state))
  File "/usr/local/lib/python3.2/sre_parse.py", line 511, in _parse
    raise error("bad repeat interval")
sre_constants.error: bad repeat interval
>>>
>>>
>>> re.search(r'a{65536}', 'a' * 100000)
Traceback (most recent call last):
  File "/usr/local/lib/python3.2/functools.py", line 176, in wrapper
    result = cache[key]
KeyError: (<class 'str'>, 'a{65536}', 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.2/re.py", line 158, in search
    return _compile(pattern, flags).search(string)
  File "/usr/local/lib/python3.2/re.py", line 255, in _compile
    return _compile_typed(type(pattern), pattern, flags)
  File "/usr/local/lib/python3.2/functools.py", line 180, in wrapper
    result = user_function(*args, **kwds)
  File "/usr/local/lib/python3.2/re.py", line 267, in _compile_typed
    return sre_compile.compile(pattern, flags)
  File "/usr/local/lib/python3.2/sre_compile.py", line 514, in compile
    groupindex, indexgroup
OverflowError: regular expression code size limit exceeded
>>>
msg152411 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2012-01-31 22:36
This issue is a duplicate of #13169.
History
Date User Action Args
2022-04-11 14:57:26adminsetgithub: 58122
2012-01-31 22:36:00vstinnersetstatus: open -> closed

nosy: + vstinner
messages: + msg152411

resolution: duplicate
2012-01-31 21:45:40py.usercreate