2019-05-20 00:14:57 +02:00
|
|
|
#ifndef Py_INTERNAL_TRACEBACK_H
|
|
|
|
|
#define Py_INTERNAL_TRACEBACK_H
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef Py_BUILD_CORE
|
|
|
|
|
# error "this header requires Py_BUILD_CORE define"
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-08-25 01:35:47 +02:00
|
|
|
// Export for '_ctypes' shared extension
|
|
|
|
|
PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, PyObject *, int, int, int *, PyObject **);
|
|
|
|
|
|
|
|
|
|
// Export for 'pyexact' shared extension
|
|
|
|
|
PyAPI_FUNC(void) _PyTraceback_Add(const char *, const char *, int);
|
|
|
|
|
|
2019-05-20 00:14:57 +02:00
|
|
|
/* Write a Unicode object into the file descriptor fd. Encode the string to
|
|
|
|
|
ASCII using the backslashreplace error handler.
|
|
|
|
|
|
2025-03-04 00:18:09 +05:00
|
|
|
Do nothing if text is not a Unicode object.
|
2019-05-20 00:14:57 +02:00
|
|
|
|
|
|
|
|
This function is signal safe. */
|
2023-07-25 04:25:45 +02:00
|
|
|
extern void _Py_DumpASCII(int fd, PyObject *text);
|
2019-05-20 00:14:57 +02:00
|
|
|
|
|
|
|
|
/* Format an integer as decimal into the file descriptor fd.
|
|
|
|
|
|
|
|
|
|
This function is signal safe. */
|
2023-07-25 04:25:45 +02:00
|
|
|
extern void _Py_DumpDecimal(
|
2019-05-20 00:14:57 +02:00
|
|
|
int fd,
|
2021-01-19 23:35:27 +01:00
|
|
|
size_t value);
|
2019-05-20 00:14:57 +02:00
|
|
|
|
2021-01-18 18:34:56 +01:00
|
|
|
/* Format an integer as hexadecimal with width digits into fd file descriptor.
|
|
|
|
|
The function is signal safe. */
|
2023-07-25 04:25:45 +02:00
|
|
|
extern void _Py_DumpHexadecimal(
|
2019-05-20 00:14:57 +02:00
|
|
|
int fd,
|
2021-01-18 18:34:56 +01:00
|
|
|
uintptr_t value,
|
2019-05-20 00:14:57 +02:00
|
|
|
Py_ssize_t width);
|
|
|
|
|
|
2026-04-16 16:55:03 -07:00
|
|
|
// Exported for external JIT support
|
|
|
|
|
PyAPI_FUNC(PyObject *) _PyTraceBack_FromFrame(
|
2019-05-23 01:00:58 +02:00
|
|
|
PyObject *tb_next,
|
2020-04-28 16:32:48 +02:00
|
|
|
PyFrameObject *frame);
|
2019-05-23 01:00:58 +02:00
|
|
|
|
2021-11-05 09:39:18 +00:00
|
|
|
#define EXCEPTION_TB_HEADER "Traceback (most recent call last):\n"
|
|
|
|
|
#define EXCEPTION_GROUP_TB_HEADER "Exception Group Traceback (most recent call last):\n"
|
|
|
|
|
|
|
|
|
|
/* Write the traceback tb to file f. Prefix each line with
|
|
|
|
|
indent spaces followed by the margin (if it is not NULL). */
|
2023-10-12 16:52:14 +02:00
|
|
|
extern int _PyTraceBack_Print(
|
|
|
|
|
PyObject *tb, const char *header, PyObject *f);
|
2023-07-25 04:25:45 +02:00
|
|
|
extern int _Py_WriteIndentedMargin(int, const char*, PyObject *);
|
|
|
|
|
extern int _Py_WriteIndent(int, PyObject *);
|
2021-11-05 09:39:18 +00:00
|
|
|
|
2025-04-21 15:48:02 -04:00
|
|
|
// Export for the faulthandler module
|
2025-07-29 10:25:32 -04:00
|
|
|
PyAPI_FUNC(void) _Py_InitDumpStack(void);
|
2025-04-21 15:48:02 -04:00
|
|
|
PyAPI_FUNC(void) _Py_DumpStack(int fd);
|
|
|
|
|
|
2025-10-27 18:41:18 +01:00
|
|
|
extern void _Py_DumpTraceback_Init(void);
|
|
|
|
|
|
2019-05-20 00:14:57 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#endif /* !Py_INTERNAL_TRACEBACK_H */
|