[IronPython] Creating a CodeContext in 2.6RC

Dino Viehland dinov at microsoft.com
Mon Sep 28 01:14:18 CEST 2009


> There's a couple of places in NWSGI where I need a CodeContext, so
> I've just been creating an empty one like so and using it (and it's
> worked so far):
>     new CodeContext(new Scope(),
> HostingHelpers.GetLanguageContext(engine))
> 
> Now, in 2.6 RC I need a PythonDictionary instead of a scope (easy
> enough), but I need a ModuleContext instead of a Language context (for
> argument 2) - how do I get one of those?
> 
> Also, this all feels horribly wrong - is there a better way that I'm
> missing?

Rather than creating a CodeContext w/ a ModuleContext you can create a
ModuleContext w/ a PythonDictionary & LanguageContext.  From there you can
the ModuleContext's GlobalContext property.



More information about the Ironpython-users mailing list