[IronPython] Setting Recursion Limit On Embedded PythonEngine

Dino Viehland dinov at exchange.microsoft.com
Thu Apr 5 23:58:04 CEST 2007

Yep, this another is one of those spots where the engine isolation falls down :(.  Unfortunately this one is currently by design.  SystemState not being a real module was done to better support multiple engines as well.  We probably won't fix that in v1.x but maybe in v2.x it could become a normal module.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord
Sent: Thursday, April 05, 2007 2:47 PM
To: Discussion of IronPython
Subject: [IronPython] Setting Recursion Limit On Embedded PythonEngine

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
users mailing list
users at lists.ironpython.com

More information about the Ironpython-users mailing list