[Python-bugs-list] [ python-Bugs-418626 ] maximum recursion limit exceeded (2.1)

noreply@sourceforge.net noreply@sourceforge.net
Tue, 02 Jul 2002 04:23:50 -0700


Bugs item #418626, was opened at 2001-04-24 12:23
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=418626&group_id=5470

Category: Regular Expressions
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Fredrik Lundh (effbot)
Summary: maximum recursion limit exceeded (2.1)

Initial Comment:
% /usr/bin/env python2.1 
Python 2.1 (#2, Apr 24 2001, 11:33:06) 
[GCC 2.95.3 20010315 (release)] on hp-uxB
Type "copyright", "credits" or "license" for more
information.
>>> 

% uname -a
HP-UX wshelley B.11.00 A 9000/785 2014123772 two-user
license
% rebug.py 
Traceback (most recent call last):
  File "rebug.py", line 205, in ?
    re.search("== Data Table ==\n(.*?)\n(.*?)\s*$",
output, re.S)
  File "/usr/local/lib/python2.1/sre.py", line 57, in
search
    return _compile(pattern, flags).search(string)
RuntimeError: maximum recursion limit exceeded


rebug.py script works correctly using python1.5.2

I submitted this bug as a followup to [ #215696 ] sre
RuntimeError when .*? matches >16K string




##### The following is the rebug.py file
#!/usr/bin/env python2.1
import re

output = """Using 

== Data Table ==
s       m:d     mb
3.300000        0.000104772187944365   
-1.23330767339032e-15
3.200000        0.000103862130408037   
-1.23481086168441e-15
3.100000        0.000102831826202984   
-1.23643366708223e-15
3.000000        0.000101671354638586   
-1.23819069775402e-15
2.900000        0.000100370082245968   
-1.24009908383179e-15
2.800000        9.89166376398503e-05   
-1.24217904419247e-15
2.700000        9.72988932844521e-05   
-1.24445461136295e-15
2.600000        9.55039568198016e-05   
-1.24695456774457e-15
2.500000        9.3518175238995e-05    
-1.24971366756711e-15
2.400000        9.13271559565959e-05   
-1.25277425005882e-15
2.300000        8.89158096852735e-05   
-1.25618839559713e-15
2.200000        8.62684210547775e-05   
-1.26002084671538e-15
2.100000        8.33687540802062e-05   
-1.26435302405962e-15
2.000000        8.02002009414518e-05   
-1.26928863786894e-15
1.900000        7.67459841300842e-05   
-1.27496167015724e-15
1.800000        7.29894239935539e-05   
-1.28154795600633e-15
1.700000        6.89142864097651e-05   
-1.28928236065365e-15
1.600000        6.45052296412595e-05   
-1.29848488989922e-15
1.500000        5.97483776126083e-05   
-1.30960148694006e-15
1.400000        5.46320649249439e-05   
-1.32326977154928e-15
1.300000        4.91478435825781e-05   
-1.3404286750276e-15
1.200000        4.32919623998454e-05   
-1.36250830892367e-15
1.100000        3.70678871330223e-05   
-1.39177202537724e-15
1.000000        3.04915786576429e-05   
-1.43195494399345e-15
0.900000        2.36052666077545e-05   
-1.48947100843164e-15
0.800000        1.65202853321069e-05   
-1.57551564136398e-15
0.700000        9.56073716566518e-06   
-1.70791288744525e-15
0.600000        3.67125710597e-06      
-1.89923336361812e-15
0.500000        6.00021904261974e-07   
-2.08381565027337e-15
0.400000        4.27864345038415e-08   
-2.14973379503184e-15
0.300000        2.5741570279509e-09    
-2.15852923041729e-15
0.200000        1.60325700603365e-10   
-2.15762110254924e-15
0.100000        1.10181009347061e-11   
-2.15430351925385e-15
0.000000        9.18460199298261e-13   
-2.14607756126421e-15
-0.100000       8.2907448480307e-14    
-2.13154544128925e-15
-0.200000       9.49291906644266e-15   
-2.09562596113738e-15
-0.300000       2.57398712712903e-15   
-1.89144055818718e-15
-0.400000       1.23896929747012e-15   
-1.18482371296596e-15
-0.500000       4.77088843470797e-16   
-4.74259070979461e-16
3.300000        0.000725333230235404   
-1.60279744215745e-14
3.200000        0.000698989627849489   
-1.57983897758426e-14
3.100000        0.000672395787137216   
-1.55721529060957e-14
3.000000        0.000645566845212758   
-1.53549883971193e-14
2.900000        0.000618516906916818   
-1.51624220311135e-14
2.800000        0.000591259277466284   
-1.50347782956977e-14
2.700000        0.000563806714724985   
-1.5069525306854e-14
2.600000        0.000536171704020601   
-1.54848062262748e-14
2.500000        0.000508366761845922   
-1.67334737461837e-14
2.400000        0.000480404778779427   
-1.96904798125589e-14
2.300000        0.00045229941701671    
-2.59347024715496e-14
2.200000        0.000424065584744255   
-3.81354821168744e-14
2.100000        0.000395720019338978   
-6.05316531752639e-14
2.000000        0.000367282025836478   
-9.9457021513997e-14
1.900000        0.000338774439198852   
-1.63825993533288e-13
1.800000        0.000310224913488982   
-2.65456611717139e-13
1.700000        0.000281667696431468   
-4.19089961445906e-13
1.600000        0.000253146138686846   
-6.4197984099406e-13
1.500000        0.000224716340367884   
-9.52983499747302e-13
1.400000        0.00019645260393449    
-1.37117106753005e-12
1.300000        0.000168455842857815   
-1.9140171376089e-12
1.200000        0.000140866992561325   
-2.5949957749272e-12
1.100000        0.000113889209694637   
-3.419066099784e-12
1.000000        8.78261401150504e-05   
-4.36958009251635e-12
0.900000        6.31506490822963e-05   
-5.36461118003355e-12
0.800000        4.06312963119592e-05   
-6.12577475587495e-12
0.700000        2.15481889941145e-05   
-5.92418822150058e-12
0.600000        7.87604367966821e-06   
-3.80859906972703e-12
0.500000        1.3904896761789e-06    
-9.79870732426348e-13
0.400000        1.06064890626322e-07   
-9.39992702457847e-14
0.300000        6.34950130197645e-09   
-1.65503941397823e-14
0.200000        3.88292805625561e-10   
-1.16204226732226e-14
0.100000        2.57865399432747e-11   
-1.11870703136006e-14
0.000000        2.05458930149398e-12   
-1.09482596289954e-14
-0.100000       1.85578779234532e-13   
-1.06729449780495e-14
-0.200000       2.5577583052963e-14    
-1.02232392679007e-14
-0.300000       1.05769385343133e-14   
-9.2322860676878e-15
-0.400000       8.00273522170935e-15   
-7.88228414475344e-15
-0.500000       6.51965630664677e-15   
-6.50815076902941e-15
3.300000        0.000778073989265561   
-1.65574096734398e-07
3.200000        0.00074963150963251    
-1.92244746339178e-07
3.100000        0.000721015586364691   
-2.21197891556889e-07
3.000000        0.000692226507232058   
-2.52254070463242e-07
2.900000        0.000663264988754168   
-2.85152554002688e-07
2.800000        0.000634132321079485   
-3.19546222567145e-07
2.700000        0.000604830546549725   
-3.54998299569146e-07
2.600000        0.000575362679604795   
-3.90981285317844e-07
2.500000        0.000545732977654778   
-4.26878409205096e-07
2.400000        0.000515947275272665   
-4.61987879332959e-07
2.300000        0.000486013397947319   
-4.95530155074015e-07
2.200000        0.000455941677304999   
-5.26658398699649e-07
2.100000        0.000425745598153737   
-5.54472176489517e-07
2.000000        0.000395442620520435   
-5.78034377120716e-07
1.900000        0.000365055239615154   
-5.96391194651538e-07
1.800000        0.000334612377612625   
-6.0859488246625e-07
1.700000        0.000304151250425071   
-6.13728816719563e-07
1.600000        0.000273719932661724   
-6.1093419812057e-07
1.500000        0.000243380977243086   
-5.99437433988553e-07
1.400000        0.000213216675616044   
-5.78576796961394e-07
1.300000        0.000183336956663227   
-5.47826196051382e-07
1.200000        0.000153891700661593   
-5.06812695554088e-07
1.100000        0.000125090796710056   
-4.55323667088038e-07
1.000000        9.7238530664174e-05    
-3.9330616509577e-07
0.900000        7.07959411929754e-05   
-3.20910962327376e-07
0.800000        4.64992533700793e-05   
-2.38877973057319e-07
0.700000        2.55795422135307e-05   
-1.50458199069334e-07
0.600000        1.00314893206752e-05   
-6.74343626580743e-08
0.500000        2.00947524041218e-06   
-1.48839482947924e-08
0.400000        1.67232105200131e-07   
-1.2816627677716e-09
0.300000        1.00809637284154e-08   
-7.82708572696571e-11
0.200000        6.12196843592758e-10   
-4.83619605089934e-12
0.100000        4.0027953235145e-11    
-3.39466185939354e-13
0.000000        3.1163322565507e-12    
-4.38427713973686e-14
-0.100000       2.82036148373174e-13   
-2.01235539818538e-14
-0.200000       4.04726306794353e-14   
-1.75747562532315e-14
-0.300000       1.83397331593843e-14   
-1.63366924660679e-14
-0.400000       1.50709750319906e-14   
-1.48901998089388e-14
-0.500000       1.34240392889815e-14   
-1.34063683071726e-14
3.300000        0.000104772187944365   
-1.23330767339032e-15
3.200000        0.000103862130408037   
-1.23481086168441e-15
3.100000        0.000102831826202984   
-1.23643366708223e-15
3.000000        0.000101671354638586   
-1.23819069775402e-15
2.900000        0.000100370082245968   
-1.24009908383179e-15
2.800000        9.89166376398503e-05   
-1.24217904419247e-15
2.700000        9.72988932844521e-05   
-1.24445461136295e-15
2.600000        9.55039568198016e-05   
-1.24695456774457e-15
2.500000        9.3518175238995e-05    
-1.24971366756711e-15
2.400000        9.13271559565959e-05   
-1.25277425005882e-15
2.300000        8.89158096852735e-05   
-1.25618839559713e-15
2.200000        8.62684210547775e-05   
-1.26002084671538e-15
2.100000        8.33687540802062e-05   
-1.26435302405962e-15
2.000000        8.02002009414518e-05   
-1.26928863786894e-15
1.900000        7.67459841300842e-05   
-1.27496167015724e-15
1.800000        7.29894239935539e-05   
-1.28154795600633e-15
1.700000        6.89142864097651e-05   
-1.28928236065365e-15
1.600000        6.45052296412595e-05   
-1.29848488989922e-15
1.500000        5.97483776126083e-05   
-1.30960148694006e-15
1.400000        5.46320649249439e-05   
-1.32326977154928e-15
1.300000        4.91478435825781e-05   
-1.3404286750276e-15
1.200000        4.32919623998454e-05   
-1.36250830892367e-15
1.100000        3.70678871330223e-05   
-1.39177202537724e-15
1.000000        3.04915786576429e-05   
-1.43195494399345e-15
0.900000        2.36052666077545e-05   
-1.48947100843164e-15
0.800000        1.65202853321069e-05   
-1.57551564136398e-15
0.700000        9.56073716566518e-06   
-1.70791288744525e-15
0.600000        3.67125710597e-06      
-1.89923336361812e-15
0.500000        6.00021904261974e-07   
-2.08381565027337e-15
0.400000        4.27864345038415e-08   
-2.14973379503184e-15
0.300000        2.5741570279509e-09    
-2.15852923041729e-15
0.200000        1.60325700603365e-10   
-2.15762110254924e-15
0.100000        1.10181009347061e-11   
-2.15430351925385e-15
0.000000        9.18460199298261e-13   
-2.14607756126421e-15
-0.100000       8.2907448480307e-14    
-2.13154544128925e-15
-0.200000       9.49291906644266e-15   
-2.09562596113738e-15
-0.300000       2.57398712712903e-15   
-1.89144055818718e-15
-0.400000       1.23896929747012e-15   
-1.18482371296596e-15
-0.500000       4.77088843470797e-16   
-4.74259070979461e-16
3.300000        0.000725333230235404   
-1.60279744215745e-14
3.200000        0.000698989627849489   
-1.57983897758426e-14
3.100000        0.000672395787137216   
-1.55721529060957e-14
3.000000        0.000645566845212758   
-1.53549883971193e-14
2.900000        0.000618516906916818   
-1.51624220311135e-14
2.800000        0.000591259277466284   
-1.50347782956977e-14
2.700000        0.000563806714724985   
-1.5069525306854e-14
2.600000        0.000536171704020601   
-1.54848062262748e-14
2.500000        0.000508366761845922   
-1.67334737461837e-14
2.400000        0.000480404778779427   
-1.96904798125589e-14
2.300000        0.00045229941701671    
-2.59347024715496e-14
2.200000        0.000424065584744255   
-3.81354821168744e-14
2.100000        0.000395720019338978   
-6.05316531752639e-14
2.000000        0.000367282025836478   
-9.9457021513997e-14
1.900000        0.000338774439198852   
-1.63825993533288e-13
1.800000        0.000310224913488982   
-2.65456611717139e-13
1.700000        0.000281667696431468   
-4.19089961445906e-13
1.600000        0.000253146138686846   
-6.4197984099406e-13
1.500000        0.000224716340367884   
-9.52983499747302e-13
1.400000        0.00019645260393449    
-1.37117106753005e-12
1.300000        0.000168455842857815   
-1.9140171376089e-12
1.200000        0.000140866992561325   
-2.5949957749272e-12
1.100000        0.000113889209694637   
-3.419066099784e-12
1.000000        8.78261401150504e-05   
-4.36958009251635e-12
0.900000        6.31506490822963e-05   
-5.36461118003355e-12
0.800000        4.06312963119592e-05   
-6.12577475587495e-12
0.700000        2.15481889941145e-05   
-5.92418822150058e-12
0.600000        7.87604367966821e-06   
-3.80859906972703e-12
0.500000        1.3904896761789e-06    
-9.79870732426348e-13
0.400000        1.06064890626322e-07   
-9.39992702457847e-14
0.300000        6.34950130197645e-09   
-1.65503941397823e-14
0.200000        3.88292805625561e-10   
-1.16204226732226e-14
0.100000        2.57865399432747e-11   
-1.11870703136006e-14
0.000000        2.05458930149398e-12   
-1.09482596289954e-14
-0.100000       1.85578779234532e-13   
-1.06729449780495e-14
-0.200000       2.5577583052963e-14    
-1.02232392679007e-14
-0.300000       1.05769385343133e-14   
-9.2322860676878e-15
-0.400000       8.00273522170935e-15   
-7.88228414475344e-15
-0.500000       6.51965630664677e-15   
-6.50815076902941e-15
"""

re.search("== Data Table ==\n(.*?)\n(.*?)\s*$", output,
re.S)



----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2002-07-02 04:23

Message:
Logged In: NO 

I have the same problem, running Python 2.1.3.

It works well under Windows XP, but fails under Linux. Both 
Python 2.1.3. This is the pattern I am trying to match:

(<table.*?>[\s,\S]*?</table>)

I use re.split in order to group code outside tables and code 
inside tables. 

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-04-24 20:28

Message:
Logged In: YES 
user_id=31435

Assigned to /F.  Works for me on Win98 under 2.1.  Binding 
m to the re result and then printing

print m.span(), len(output), m.span(1), m.span(2)

yields

(8, 12112) 12112 (25, 43) (44, 12111)

Anonymous, this is a poor use for regexps:  the code would 
be clearer, simpler and faster (plus it wouldn't blow up 
<wink>) if you used basic string operations instead.  The 
(.*?)\s*$ at the end is especially wasteful:  you're 
teilling the regexp engine to do 12,000+ useless match 
attempts there, when all you *want* is the entire tail end 
of the string stripped of trailing whitespace.  So just 
grab the tail end of the string directly and do 
string.rstrip() on it; saves 12,000+ useless matching 
attempts.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=418626&group_id=5470