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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to