comparison 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
comparison
equal deleted inserted replaced
28553:62e883e2d517 28556:78395e5b4782
15 */ 15 */
16 16
17 #include "Python.h" 17 #include "Python.h"
18 #include "compile.h" 18 #include "compile.h"
19 #include "frameobject.h" 19 #include "frameobject.h"
20 #include "eval.h"
20 21
21 #include "osdefs.h" 22 #include "osdefs.h"
22 23
23 #ifdef MS_WINDOWS 24 #ifdef MS_WINDOWS
24 #define WIN32_LEAN_AND_MEAN 25 #define WIN32_LEAN_AND_MEAN
607 } 608 }
608 Py_INCREF(f); 609 Py_INCREF(f);
609 return (PyObject*)f; 610 return (PyObject*)f;
610 } 611 }
611 612
613 PyDoc_STRVAR(call_tracing_doc,
614 "call_tracing(func, args) -> object\n\
615 \n\
616 Call func(*args), while tracing is enabled. The tracing state is\n\
617 saved, and restored afterwards. This is intended to be called from\n\
618 a debugger from a checkpoint, to recursively debug some other code."
619 );
620
621 static PyObject *
622 sys_call_tracing(PyObject *self, PyObject *args)
623 {
624 PyObject *func, *funcargs;
625 if (!PyArg_ParseTuple(args, "OO:call_tracing", &func, &funcargs))
626 return NULL;
627 return _PyEval_CallTracing(func, funcargs);
628 }
629
612 PyDoc_STRVAR(callstats_doc, 630 PyDoc_STRVAR(callstats_doc,
613 "callstats() -> tuple of integers\n\ 631 "callstats() -> tuple of integers\n\
614 \n\ 632 \n\
615 Return a tuple of function call statistics, if CALL_PROFILE was defined\n\ 633 Return a tuple of function call statistics, if CALL_PROFILE was defined\n\
616 when Python was built. Otherwise, return None.\n\ 634 when Python was built. Otherwise, return None.\n\
698 #endif 716 #endif
699 {"setprofile", sys_setprofile, METH_O, setprofile_doc}, 717 {"setprofile", sys_setprofile, METH_O, setprofile_doc},
700 {"setrecursionlimit", sys_setrecursionlimit, METH_VARARGS, 718 {"setrecursionlimit", sys_setrecursionlimit, METH_VARARGS,
701 setrecursionlimit_doc}, 719 setrecursionlimit_doc},
702 {"settrace", sys_settrace, METH_O, settrace_doc}, 720 {"settrace", sys_settrace, METH_O, settrace_doc},
721 {"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc},
703 {NULL, NULL} /* sentinel */ 722 {NULL, NULL} /* sentinel */
704 }; 723 };
705 724
706 static PyObject * 725 static PyObject *
707 list_builtin_module_names(void) 726 list_builtin_module_names(void)