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)
28 if (!PyArg_ParseTuple(args, "OO", &tb, &next))
30 if (!(PyTraceBack_Check(tb) && (PyTraceBack_Check(next) ||
32 PyErr_SetString(PyExc_TypeError, "traceback object required.");
36 ((PyTracebackObject*)tb)->tb_next = next;
43 static PyMethodDef module_methods[] = {
44 {"tb_set_next", (PyCFunction)tb_set_next, METH_VARARGS,
45 "Set the tb_next member of a traceback object."},
46 {NULL, NULL, 0, NULL} /* Sentinel */
49 #ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
50 #define PyMODINIT_FUNC void
55 PyObject *module = Py_InitModule3("_debugger", module_methods, "");