diff Python/sysmodule.c @ 39056:b6fd499e4343 legacy-trunk

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.
author Tim Peters <tim.peters@gmail.com>
date Mon, 10 Jul 2006 21:08:24 +0000
parents 6ae418e4b36a
children f2031f15d99d
line wrap: on
line diff
--- a/Python/sysmodule.c	Mon Jul 10 20:39:49 2006 +0000
+++ b/Python/sysmodule.c	Mon Jul 10 21:08:24 2006 +0000
@@ -660,6 +660,21 @@
 	return (PyObject*)f;
 }
 
+PyDoc_STRVAR(current_frames_doc,
+"_current_frames() -> dictionary\n\
+\n\
+Return a dictionary mapping each current thread T's thread id to T's\n\
+current stack frame.\n\
+\n\
+This function should be used for specialized purposes only."
+);
+
+static PyObject *
+sys_current_frames(PyObject *self, PyObject *noargs)
+{
+	return _PyThread_CurrentFrames();
+}
+
 PyDoc_STRVAR(call_tracing_doc,
 "call_tracing(func, args) -> object\n\
 \n\
@@ -722,6 +737,8 @@
 	/* Might as well keep this in alphabetic order */
 	{"callstats", (PyCFunction)PyEval_GetCallStats, METH_NOARGS,
 	 callstats_doc},
+	{"_current_frames", sys_current_frames, METH_NOARGS,
+	 current_frames_doc},
 	{"displayhook",	sys_displayhook, METH_O, displayhook_doc},
 	{"exc_info",	sys_exc_info, METH_NOARGS, exc_info_doc},
 	{"exc_clear",	sys_exc_clear, METH_NOARGS, exc_clear_doc},