comparison 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
comparison
equal deleted inserted replaced
39055:3b38ab9c4b03 39056:b6fd499e4343
658 } 658 }
659 Py_INCREF(f); 659 Py_INCREF(f);
660 return (PyObject*)f; 660 return (PyObject*)f;
661 } 661 }
662 662
663 PyDoc_STRVAR(current_frames_doc,
664 "_current_frames() -> dictionary\n\
665 \n\
666 Return a dictionary mapping each current thread T's thread id to T's\n\
667 current stack frame.\n\
668 \n\
669 This function should be used for specialized purposes only."
670 );
671
672 static PyObject *
673 sys_current_frames(PyObject *self, PyObject *noargs)
674 {
675 return _PyThread_CurrentFrames();
676 }
677
663 PyDoc_STRVAR(call_tracing_doc, 678 PyDoc_STRVAR(call_tracing_doc,
664 "call_tracing(func, args) -> object\n\ 679 "call_tracing(func, args) -> object\n\
665 \n\ 680 \n\
666 Call func(*args), while tracing is enabled. The tracing state is\n\ 681 Call func(*args), while tracing is enabled. The tracing state is\n\
667 saved, and restored afterwards. This is intended to be called from\n\ 682 saved, and restored afterwards. This is intended to be called from\n\
720 735
721 static PyMethodDef sys_methods[] = { 736 static PyMethodDef sys_methods[] = {
722 /* Might as well keep this in alphabetic order */ 737 /* Might as well keep this in alphabetic order */
723 {"callstats", (PyCFunction)PyEval_GetCallStats, METH_NOARGS, 738 {"callstats", (PyCFunction)PyEval_GetCallStats, METH_NOARGS,
724 callstats_doc}, 739 callstats_doc},
740 {"_current_frames", sys_current_frames, METH_NOARGS,
741 current_frames_doc},
725 {"displayhook", sys_displayhook, METH_O, displayhook_doc}, 742 {"displayhook", sys_displayhook, METH_O, displayhook_doc},
726 {"exc_info", sys_exc_info, METH_NOARGS, exc_info_doc}, 743 {"exc_info", sys_exc_info, METH_NOARGS, exc_info_doc},
727 {"exc_clear", sys_exc_clear, METH_NOARGS, exc_clear_doc}, 744 {"exc_clear", sys_exc_clear, METH_NOARGS, exc_clear_doc},
728 {"excepthook", sys_excepthook, METH_VARARGS, excepthook_doc}, 745 {"excepthook", sys_excepthook, METH_VARARGS, excepthook_doc},
729 {"exit", sys_exit, METH_VARARGS, exit_doc}, 746 {"exit", sys_exit, METH_VARARGS, exit_doc},