[IronPython] __main__ module and global variables issue...

Alex Henderson alex at syzmk.com
Sun Jul 2 06:45:56 CEST 2006

Our system is using IP for an expression engine - in most cases we are
creating a new ModuleScope and evaluating against it, which works fine ie.
On setup we assign some global variables, and generate functions on the fly
for the lifetime of the module which are evaluated, and thrown away after

However I've also been using the default module scope for evaluating some
expressions, and I seem to be getting some odd behavior... where any global
variables we've assigned (in this case, "_container", "_log" and "_config")
at some indeterminate point end up reverting to None values - the names
still exist, but the references to the class instances have gone.

This is only happening for the default module scope, everything works as
expected when we create our own module scope... and there's no code being
executed other then that which sets the global variables in the first place,
which is definitely assigning non-null values (I've changed the methods to
set then fetch the value to make sure).

Is there perhaps something different between a scope I've created using new
ModuleScope(), and the PythonEngine's DefaultModuleScope with regards to
global variables?


 - Alex

More information about the Ironpython-users mailing list