[Patches] [ python-Patches-421709 ] Access { thread id : frame } dict

noreply@sourceforge.net noreply@sourceforge.net
Mon, 04 Jun 2001 10:28:59 -0700


Patches item #421709, was updated on 2001-05-05 13:30
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=421709&group_id=5470

Category: core (C code)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: John D. Heintz (jheintz)
Assigned to: Barry Warsaw (bwarsaw)
Summary: Access { thread id : frame } dict

Initial Comment:
This patch adds a new function sys._getframes() that 
returns a dictionary mapping from thread id to 
current frame object.

This is very useful when diagnosing deadlock issues 
in Python code.

The new C code function is purely additive except for 
modifying the PyThreadState struct (adding a long 
thread_ident) and modifying PyThreadState_New() 
function to set this new long.



----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2001-06-04 10:28

Message:
Logged In: YES 
user_id=21627

I think the patch could use some more documentation, e.g. 
as a patch to Doc/lib/libsys.tex. E.g. what are the tuples 
that are put into the dictionaries?

Also, isn't there a problem with the tuple size? The patch 
allocates tuples of size 0, but then puts things into 
index 0. Is there any kind of test case for this code?

Finally, I don't think the docstring should say that the 
function is for internal and specialized purposes only 
(what specialized purposes, anyway), if you think its 
primary use is in diagnosing deadlocks. It should only 
document what the function does, not what you intend it to 
use for.

For these reasons, I also think its name should not start 
with an underscore.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=421709&group_id=5470