[IronPython] Setting Recursion Limit On Embedded PythonEngine

Michael Foord fuzzyman at voidspace.org.uk
Thu Apr 5 23:47:27 CEST 2007

Hello all,

Setting the recursion limit on an embedded PythonEngine also affects the 
current engine. (We were hoping that using an embedded engine would 
shield our main environment from our users doing daft things like this 
in their code).

 >>> from IronPython.Hosting import PythonEngine
 >>> e = PythonEngine()
 >>> e.Sys.getrecursionlimit()
 >>> e.Sys.setrecursionlimit(2)
 >>> import sys
 >>> sys.getrecursionlimit()
 >>> e.Sys.getrecursionlimit()

By the way - the 'sys' module is a 'SystemState' object, which isn't in 
the API documentation (at least not in 1.0.1).

We had to dig into the sources (which wasn't such a bad thing) to learn 
about it.


Michael Foord

More information about the Ironpython-users mailing list