summaryrefslogtreecommitdiff
path: root/Modules/_testcapimodule.c
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2008-04-28 03:23:50 +0000
committerBrett Cannon <bcannon@gmail.com>2008-04-28 03:23:50 +0000
commit141534e56fccd9feb049c0c4115ab7e66688196c (patch)
tree807d95a7e49eadb6d09c71f341acae2c328f2535 /Modules/_testcapimodule.c
parentf30f6e82166bb9364a833e09de002ee438c74ad9 (diff)
downloadcpython-git-141534e56fccd9feb049c0c4115ab7e66688196c.tar.gz
Fix a bug introduced by the warnings rewrite where tracebacks were being
improperly indented. Closes issue #2699.
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r--Modules/_testcapimodule.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 40eaaad63e..8b4dbce60a 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -734,6 +734,24 @@ test_with_docstring(PyObject *self)
Py_RETURN_NONE;
}
+/* To test the format of tracebacks as printed out. */
+static PyObject *
+test_traceback_print(PyObject *self, PyObject *args)
+{
+ PyObject *file;
+ PyObject *traceback;
+ int result;
+
+ if (!PyArg_ParseTuple(args, "OO:test_traceback_print",
+ &traceback, &file))
+ return NULL;
+
+ result = PyTraceBack_Print(traceback, file);
+ if (result < 0)
+ return NULL;
+ Py_RETURN_NONE;
+}
+
static PyMethodDef TestMethods[] = {
{"raise_exception", raise_exception, METH_VARARGS},
{"test_config", (PyCFunction)test_config, METH_NOARGS},
@@ -774,6 +792,7 @@ static PyMethodDef TestMethods[] = {
#ifdef WITH_THREAD
{"_test_thread_state", test_thread_state, METH_VARARGS},
#endif
+ {"test_traceback_print", test_traceback_print, METH_VARARGS},
{NULL, NULL} /* sentinel */
};