mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
Fix a bug introduced by the warnings rewrite where tracebacks were being
improperly indented. Closes issue #2699.
This commit is contained in:
parent
f30f6e8216
commit
141534e56f
3 changed files with 47 additions and 4 deletions
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue