12
/* Traceback interface */
13
#ifndef Py_LIMITED_API
14
typedef struct _traceback {
16
struct _traceback *tb_next;
17
struct _frame *tb_frame;
23
PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *);
24
PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *);
25
#ifndef Py_LIMITED_API
26
PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, PyObject *, int, int);
29
/* Reveal traceback type so we can typecheck traceback objects */
30
PyAPI_DATA(PyTypeObject) PyTraceBack_Type;
31
#define PyTraceBack_Check(v) (Py_TYPE(v) == &PyTraceBack_Type)
33
/* Write the Python traceback into the file 'fd'. For example:
35
Traceback (most recent call first):
36
File "xxx", line xxx in <xxx>
37
File "xxx", line xxx in <xxx>
39
File "xxx", line xxx in <xxx>
41
This function is written for debug purpose only, to dump the traceback in
42
the worst case: after a segmentation fault, at fatal error, etc. That's why,
43
it is very limited. Strings are truncated to 100 characters and encoded to
44
ASCII with backslashreplace. It doesn't write the source code, only the
45
function name, filename and line number of each frame. Write only the first
46
100 frames: if the traceback is truncated, write the line " ...".
48
This function is signal safe. */
50
PyAPI_DATA(void) _Py_DumpTraceback(
52
PyThreadState *tstate);
54
/* Write the traceback of all threads into the file 'fd'. current_thread can be
55
NULL. Return NULL on success, or an error message on error.
57
This function is written for debug purpose only. It calls
58
_Py_DumpTraceback() for each thread, and so has the same limitations. It
59
only write the traceback of the first 100 threads: write "..." if there are
62
This function is signal safe. */
64
PyAPI_DATA(const char*) _Py_DumpTracebackThreads(
65
int fd, PyInterpreterState *interp,
66
PyThreadState *current_thread);
72
#endif /* !Py_TRACEBACK_H */