5 * C implementation of `tb_set_next`.
7 * :copyright: (c) 2010 by the Jinja Team.
15 tb_set_next(PyObject
*self
, PyObject
*args
)
17 PyTracebackObject
*tb
, *old
;
20 if (!PyArg_ParseTuple(args
, "O!O:tb_set_next", &PyTraceBack_Type
, &tb
, &next
))
24 else if (!PyTraceBack_Check(next
)) {
25 PyErr_SetString(PyExc_TypeError
,
26 "tb_set_next arg 2 must be traceback or None");
33 tb
->tb_next
= (PyTracebackObject
*)next
;
40 static PyMethodDef module_methods
[] = {
41 {"tb_set_next", (PyCFunction
)tb_set_next
, METH_VARARGS
,
42 "Set the tb_next member of a traceback object."},
43 {NULL
, NULL
, 0, NULL
} /* Sentinel */
47 #if PY_MAJOR_VERSION < 3
49 #ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
50 #define PyMODINIT_FUNC void
53 init_debugsupport(void)
55 Py_InitModule3("jinja2._debugsupport", module_methods
, "");
58 #else /* Python 3.x module initialization */
60 static struct PyModuleDef module_definition
= {
61 PyModuleDef_HEAD_INIT
,
62 "jinja2._debugsupport",
73 PyInit__debugsupport(void)
75 return PyModule_Create(&module_definition
);