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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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: [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