[Python-bugs-list] [ python-Bugs-756576 ] Recursion limit too high for MacOSX

SourceForge.net noreply@sourceforge.net
Sun, 22 Jun 2003 14:59:09 -0700


Bugs item #756576, was opened at 2003-06-18 15:01
Message generated for change (Comment added) made by jackjansen
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=756576&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jack Jansen (jackjansen)
Assigned to: Nobody/Anonymous (nobody)
Summary: Recursion limit too high for MacOSX

Initial Comment:
Python's recursion limit is too high for Mac OS X, where the 
default stack size is 512K. The attached script will never 
trigger a maximum recursion depth exception, it will have 
crashed Python with a segmentation violation before that.

A possible solution is a call to sys.setrecursionlimit() in 
site.py, another is to change the number "1000" in ceval.c 
to a configure-time constant.

Other platforms may also suffer this problem, it may be a 
good idea to add a test_stackoverflow.

I'm willing to do the work involved, but I'd like some 
feedback first.

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

>Comment By: Jack Jansen (jackjansen)
Date: 2003-06-22 23:59

Message:
Logged In: YES 
user_id=45365

A runtime mechanism is already available (PyOS_CheckStack), 
but it is only used on platforms where a stack overrun would be 
disastrous (i.e. run into your heap in stead of giving a SEGV), 
because it is pretty expensive. If there is a common way to do 
this easier (i.e. set a red zone pointer and do one pointer 
compare in a stack test macro) I would be all for it, bt I don't 
know how to do this.

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

Comment By: Martin v. Löwis (loewis)
Date: 2003-06-21 15:50

Message:
Logged In: YES 
user_id=21627

If more work is put into recursion limits, I think platform
mechanisms should be used where available. For example,
there might be ways to find out, at run-time, what the stack
consumption is, and what the stack availalability is, and
compute a recursion limit from that.

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

Comment By: Jeremy Hylton (jhylton)
Date: 2003-06-18 17:40

Message:
Logged In: YES 
user_id=31392

I'd like to see a per-platform recusion limit, because the
limit could be much higher on Linux and Windows than 1000.


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

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