2 * Jinja Extended Debugger
3 * ~~~~~~~~~~~~~~~~~~~~~~~
5 * this module allows the jinja debugger to set the tb_next flag
6 * on traceback objects. This is required to inject a traceback into
9 * For better windows support (not everybody has a visual studio 2003
10 * at home) it would be a good thing to have a ctypes implementation, but
11 * because the struct is not exported there is currently no sane way.
13 * :copyright: 2007 by Armin Ronacher.
14 * :license: BSD, see LICENSE for more details.
21 * set the tb_next attribute of a traceback object
24 tb_set_next(PyObject *self, PyObject *args)
26 PyTracebackObject *tb, *old;
29 if (!PyArg_ParseTuple(args, "O!O:tb_set_next", &PyTraceBack_Type, &tb, &next))
33 else if (!PyTraceBack_Check(next)) {
34 PyErr_SetString(PyExc_TypeError,
35 "tb_set_next arg 2 must be traceback or None");
42 tb->tb_next = (PyTracebackObject*)next;
50 static PyMethodDef module_methods[] = {
51 {"tb_set_next", (PyCFunction)tb_set_next, METH_VARARGS,
52 "Set the tb_next member of a traceback object."},
53 {NULL, NULL, 0, NULL} /* Sentinel */
56 #ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
57 #define PyMODINIT_FUNC void
62 PyObject *module = Py_InitModule3("jinja._debugger", module_methods, "");