After approval from Anthony, merge the tim-current_frames
branch into the trunk. This adds a new sys._current_frames()
function, which returns a dict mapping thread id to topmost
thread stack frame.
diff --git a/Doc/lib/libsys.tex b/Doc/lib/libsys.tex
index 686e50e..d55aac3 100644
--- a/Doc/lib/libsys.tex
+++ b/Doc/lib/libsys.tex
@@ -41,7 +41,7 @@
\code{Include/patchlevel.h} if the branch is a tag. Otherwise,
it is \code{None}.
\versionadded{2.5}
-\end{datadesc}
+\end{datadesc}
\begin{datadesc}{builtin_module_names}
A tuple of strings giving the names of all modules that are compiled
@@ -55,6 +55,23 @@
interpreter.
\end{datadesc}
+\begin{funcdesc}{_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 \refmodule{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.
+ \versionadded{2.5}
+\end{funcdesc}
+
\begin{datadesc}{dllhandle}
Integer specifying the handle of the Python DLL.
Availability: Windows.
@@ -142,7 +159,7 @@
function, \function{exc_info()} will return three \code{None} values until
another exception is raised in the current thread or the execution stack
returns to a frame where another exception is being handled.
-
+
This function is only needed in only a few obscure situations. These
include logging and error handling systems that report information on the
last or current exception. This function can also be used to try to free
@@ -241,7 +258,7 @@
\begin{itemize}
\item On Windows 9x, the encoding is ``mbcs''.
\item On Mac OS X, the encoding is ``utf-8''.
-\item On Unix, the encoding is the user's preference
+\item On Unix, the encoding is the user's preference
according to the result of nl_langinfo(CODESET), or None if
the nl_langinfo(CODESET) failed.
\item On Windows NT+, file names are Unicode natively, so no conversion
@@ -279,8 +296,8 @@
\end{funcdesc}
\begin{funcdesc}{getwindowsversion}{}
- Return a tuple containing five components, describing the Windows
- version currently running. The elements are \var{major}, \var{minor},
+ Return a tuple containing five components, describing the Windows
+ version currently running. The elements are \var{major}, \var{minor},
\var{build}, \var{platform}, and \var{text}. \var{text} contains
a string while all other values are integers.
@@ -491,7 +508,7 @@
be registered using \function{settrace()} for each thread being
debugged. \note{The \function{settrace()} function is intended only
for implementing debuggers, profilers, coverage tools and the like.
- Its behavior is part of the implementation platform, rather than
+ Its behavior is part of the implementation platform, rather than
part of the language definition, and thus may not be available in
all Python implementations.}
\end{funcdesc}