En Sat, 09 Jun 2007 21:40:40 -0300, Fabio Zadrozny <[EMAIL PROTECTED]>  
escribió:

> Is there some way to get all the frames for any given thread? -- in a way
> that does not require a compiled extension.

For the current (calling) thread, you can use sys._getframe()
For other threads, you can use sys._current_frames()
Frames have a f_back attribute pointing to the previous one, that you can  
use to navigate them.

Quoting <http://docs.python.org/lib/module-sys.html>
sys._current_frames: Return a dictionary mapping each thread's identifier  
to the topmost stack frame currently active in that thread at the time the  
function is called. Note that functions in the traceback module can build  
the call stack given such a frame.
This is most useful for debugging deadlock: this function does not require  
the deadlocked threads' cooperation, and such threads' call stacks are  
frozen for as long as they remain deadlocked. The frame returned for a  
non-deadlocked thread may bear no relationship to that thread's current  
activity by the time calling code examines the frame.
This function should be used for internal and specialized purposes only.  
New in version 2.5.

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to