[IronPython] Accessing call stack

Dino Viehland dinov at exchange.microsoft.com
Thu Sep 20 23:50:56 CEST 2007


Yeah, that's a reasonable idea... I've added a comment to the bug to take a look at that too.  Even if we expose the frame information via sys._getframe() there will still be some missing information that's hard for us to produce, but it might be able to unblock a number of useful scenarios.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Lee Culver
Sent: Thursday, September 20, 2007 1:35 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Accessing call stack

In a related problem, could you guys take another look at sys._getframe when implementing this feature?  There is a lot going on in the returned frame object from that function, but I think the big holdup for this is the stack frame information.  If the answer is still "no we aren't ready for that," this is ok, but I figure after implementing stack frame support within the DLR would be a good time to look at this.

This function is required to support several things which cPython has, but most importantly I'm pretty sure this is the major stumbling block towards getting IPython working with IronPython.  I go through IPython withdrawals every time I use the IronPython console.  :)

Thanks,
-Lee

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland
Sent: Thursday, September 20, 2007 9:01 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Accessing call stack

Unfortunately there's no good way to do this.  We have logic in PythonEngine to filter stack frames but it's only exposed for doing this on exceptions, not on arbitrary stack traces.  And unfortunately v2.0 is in about the same shape - all of its support revolves around exceptions too and it's filtering is probably even less useful than v1.x's for these purposes.

I've opened up a feature request to add this because it does seem like something that will be fundamentally needed (especially as more languages run on the DLR) and it's pretty basic functionality.  The bug tracking it is here: http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=12876

Unfortunately it may not be entirely simple because DynamicMethod's have no debugging info (and that's what much of the code gets generated as) but we should be able to do something here.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Anders M. Mikkelsen
Sent: Thursday, September 20, 2007 3:54 AM
To: Discussion of IronPython
Subject: [IronPython] Accessing call stack

Hi

Is there any way of accessing the python call stack in IronPython.
I'we tried using System.Diagnostics.StackTrace but most calls
on the clr call stack seem to be ironpython 'internals':

def Log(msg):
    '''General logging function'''
    print "%s: %s" % (StackTrace(1).GetFrame(0).GetMethod().Name, msg)
I could search the stack trace for actual python functions (I guess) as
their clr name seem to end in $fN; but I'm guessing that there must be
an easier way?


/anders
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20070920/94aa20b6/attachment.html>


More information about the Ironpython-users mailing list