I'm guessing the comparison to CPython here is a comparison to code that has 
been exec'd or eval'd.  You can pass a PythonCompilerOptions to 
scriptSource.Compile with ModuleOptions.ExecOrEvalCode and you should then get 
the 1.x/CPython behavior.

From: [email protected] 
[mailto:[email protected]] On Behalf Of Glenn Jones
Sent: Wednesday, December 17, 2008 9:38 AM
To: Discussion of IronPython
Subject: [IronPython] Change in stack traces

Hi all,

Another observation from the Resolver One upgrade:
When we run the following:
        engine = Python.CreateEngine()
        scope = engine.CreateScope()
        script = """
def Fn():
    raise Exception
Fn()
"""
        source = engine.CreateScriptSourceFromString(script, 'aname', 
SourceCodeKind.Statements)
        code = source.Compile()
        code.Execute(scope)

We get a stacktrace that looks like this:
  File "stacktrace.py", line 10, in testStackTrace
    code.Execute(scope)
  File "aname", line 4, in aname
  File "aname", line 3, in Fn

The equivalent code in IPy1 and Python 2.5, has
  File "aname", line 4, in <module>
instead of
  File "aname", line 4, in aname


When we don't pass the name into the call to CreateScriptSourceFromString, we 
get:
  File "stacktrace.py", line 10, in testStackTrace
    code.Execute(scope)
  File "<string>", line 4, in <module>
  File "<string>", line 3, in Fn

Is there a way for us to get behaviour like IPy1 and Python 2.5? Is this 
possibly a bug in the traceback generation of IPy2?

Thanks
Glenn
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to