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: Maximum recursion limit exceeded
Type: Stage:
Components: Regular Expressions Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: effbot Nosy List: calvin, effbot, markus_gritsch, skip.montanaro
Priority: normal Keywords:

Created on 2002-05-27 12:27 by markus_gritsch, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (3)
msg10936 - (view) Author: Markus Gritsch (markus_gritsch) Date: 2002-05-27 12:27
Hi!

I think I discovered a limitation of the "new" Regular
Expression engine.  I
have put together an example which shows the behavior at
 
http://stud4.tuwien.ac.at/~e9326522/temporary/re_bug_example.zip
(69kB)

When the script is run with Python 1.5.2 by invoking
  psmergeNS.py *.ps

everything is fine and it produces a merged output file
containing both
PostScript files.

When using Python 2.x the following Exception is raised:

  Traceback (most recent call last):
    File "psmergeNS4.py", line 35, in ?
      pages = theRE.findall(contents)
  RuntimeError: maximum recursion limit exceeded

This behavior is the same with the Linux and the Win32
version of Python.

Markus

msg10937 - (view) Author: Bastian Kleineidam (calvin) Date: 2002-05-29 12:05
Logged In: YES 
user_id=9205

I had the same problem, but only when using *? matching
several kB text.
It seems the the *? backtracking function is recursive and
cannot handle several thousand characters...

Greetings
msg10938 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2002-06-02 13:03
Logged In: YES 
user_id=44345

Saving /F the trouble of closing this, since it's a duplicate of 
<http://python.org/sf/493252> and several others.  Read the followups 
there for ways to avoid/workaround the problem.  If you absolutely can't 
modify your regular expression to be less abusive of the stack, you can 
always 

    import pre as re

and deal with the long match times you'll encounter instead.
History
Date User Action Args
2022-04-10 16:05:21adminsetgithub: 36651
2002-05-27 12:27:16markus_gritschcreate