[IronPython] Default recursion limit

Michael Foord fuzzyman at voidspace.org.uk
Wed Oct 3 01:53:27 CEST 2007

Hello all,

For IronPython the default recursion limit is maxint: 2147483647

This is too deep for .NET - and infinite recursion causes the process to 
be terminated with a stack overflow exception.

You can fix this by calling "sys.setrecursionlimit(something)" with 
something sensible - but an unfeasibly large value as the default seems 
incorrect (?).

There is a further performance related issue. Generally IronPython is 
much faster for recursion due to lower overhead in function calls. For 
recursion depths of about 5000 though, IronPython takes *much* longer to 
raise an error than CPython (about 10 seconds as opposed to half a 
second or less).


More information about the Ironpython-users mailing list