[IronPython] Error when using Options.FastEval

Martin Maly Martin.Maly at microsoft.com
Tue Oct 4 23:13:50 CEST 2005

Hi  Szymon,

Sorry for delayed response.

The exact difference between the two modes is that FastEval does not
generate IL to be executed. Instead, it walks the abstract syntax tree
and evaluates the expressions directly.

The reason you are seeing the error is that the name resolution for the
expression evaluator doesn't consider built-in names (str, int, None,
...). There may be bugs beyond this simple one, but after getting the
name resolution to consider built-in names, referencing "str", "None"
and the like does work.

I am going to include the fix in the 0.9.3 release.


-----Original Message-----
From: users-ironpython.com-bounces at lists.ironpython.com
[mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of
Szymon Kobalczyk
Sent: Tuesday, October 04, 2005 12:26 PM
To: users-ironpython.com at lists.ironpython.com
Subject: [IronPython] Error when using Options.FastEval


Few days ago I wrote about a problem with Options.FastEval. I noticed
today that accidentally it was posted as replay to some other topic and
I'm not sure that anyone has seen it. So here it is again:


Last time I wrote here I was concerned with memory consumption and
performance of embedding IronPython. I decided then to use the FastEval

I think I found some error in this mode. In code below the last line
would throw "Key not found in dictionary." exception caused by the
"None" term. When you don't use the FastEval the code runs properly.

       static void Main(string[] args)
           IronPython.AST.Options.FastEval = true;
           IronPython.AST.Options.DoNotSaveBinaries = true;

           PythonEngine engine = new PythonEngine();

           engine.SetVariable("item", null);
           object value = engine.Evaluate("item == None");

Also, could you please explain what exactly are the differences between
the two modes.

Szymon Kobalczyk.

PS: Just found that it also doesn't work for the "str" builtin function
but didn't have time to try others.

users-ironpython.com mailing list
users-ironpython.com at lists.ironpython.com

More information about the Ironpython-users mailing list