Request for Python 1.6 or higher: catch infinite recursion before Windows does!
Warren Postma
embed at geocities.com
Mon Mar 27 16:40:42 EST 2000
>
> I betcha Stackless doesn't have this problem.... Hmm. Where are Stackless
> binaries for Windows!? I'm gonna go find them, finally...
>
Hmm. DLL is 4k smaller, IDLE still runs, and my infinite recursion routine
leads to a much friendlier end:
RuntimeError: Maximum recursion depth exceeded
Way to go Christian Tismer! I'm a believer! :-)
Interesting detail: Takes IDLE a few MINUTES to dump the traceback for about
10000 lines of traceback information. Maybe tracebacks should be limitd to a
maximum of 10 levels, or should print "..." wherever a loop in recursion is
detected.
Sample of IDLE output:
Python 1.5.42 (#0, Jan 31 2000, 14:05:14) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
IDLE 0.5 -- press F1 for help
>>> def foobar(X):
return X*foobar(5)
>>> foobar(5)
Traceback (innermost last):
File "<pyshell#5>", line 1, in ?
foobar(5)
File "<pyshell#4>", line 2, in foobar
return X*foobar(5)
File "<pyshell#4>", line 2, in foobar
return X*foobar(5)
[9980 lines deleted here!]
RuntimeError: Maximum recursion depth exceeded
>>>
Warren
More information about the Python-list
mailing list