Mercurial > cpython-lru_cache-weakref
diff Python/sysmodule.c @ 28556:78395e5b4782 legacy-trunk
- New function sys.call_tracing() allows pdb to debug code
recursively.
- pdb has a new command, "debug", which lets you step through
arbitrary code from the debugger's (pdb) prompt.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 09 Apr 2003 19:06:21 +0000 |
| parents | 3f90d21debe9 |
| children | ac487a7f7f2c |
line wrap: on
line diff
--- a/Python/sysmodule.c Wed Apr 09 18:15:57 2003 +0000 +++ b/Python/sysmodule.c Wed Apr 09 19:06:21 2003 +0000 @@ -17,6 +17,7 @@ #include "Python.h" #include "compile.h" #include "frameobject.h" +#include "eval.h" #include "osdefs.h" @@ -609,6 +610,23 @@ return (PyObject*)f; } +PyDoc_STRVAR(call_tracing_doc, +"call_tracing(func, args) -> object\n\ +\n\ +Call func(*args), while tracing is enabled. The tracing state is\n\ +saved, and restored afterwards. This is intended to be called from\n\ +a debugger from a checkpoint, to recursively debug some other code." +); + +static PyObject * +sys_call_tracing(PyObject *self, PyObject *args) +{ + PyObject *func, *funcargs; + if (!PyArg_ParseTuple(args, "OO:call_tracing", &func, &funcargs)) + return NULL; + return _PyEval_CallTracing(func, funcargs); +} + PyDoc_STRVAR(callstats_doc, "callstats() -> tuple of integers\n\ \n\ @@ -700,6 +718,7 @@ {"setrecursionlimit", sys_setrecursionlimit, METH_VARARGS, setrecursionlimit_doc}, {"settrace", sys_settrace, METH_O, settrace_doc}, + {"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc}, {NULL, NULL} /* sentinel */ };
