[IronPython] Change in stack traces
Dino Viehland
dinov at microsoft.com
Wed Dec 17 18:51:05 CET 2008
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: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20081217/d5fdfd5b/attachment.html>
More information about the Ironpython-users
mailing list