Skip to content

Commit 3509b26

Browse files
authored
bpo-45292: [PEP 654] Update traceback display code to work with exception groups (GH-29207)
1 parent e52f9be commit 3509b26

File tree

6 files changed

+1017
-87
lines changed

6 files changed

+1017
-87
lines changed

Include/internal/pycore_traceback.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,17 @@ PyAPI_FUNC(PyObject*) _PyTraceBack_FromFrame(
8787
PyObject *tb_next,
8888
PyFrameObject *frame);
8989

90+
#define EXCEPTION_TB_HEADER "Traceback (most recent call last):\n"
91+
#define EXCEPTION_GROUP_TB_HEADER "Exception Group Traceback (most recent call last):\n"
92+
93+
/* Write the traceback tb to file f. Prefix each line with
94+
indent spaces followed by the margin (if it is not NULL). */
95+
PyAPI_FUNC(int) _PyTraceBack_Print_Indented(
96+
PyObject *tb, int indent, const char* margin,
97+
const char *header_margin, const char *header, PyObject *f);
98+
PyAPI_FUNC(int) _Py_WriteIndentedMargin(int, const char*, PyObject *);
99+
PyAPI_FUNC(int) _Py_WriteIndent(int, PyObject *);
100+
90101
#ifdef __cplusplus
91102
}
92103
#endif

0 commit comments

Comments
 (0)