| 1 |
#ifndef Py_CPYTHON_ERRORS_H |
| 2 |
# error "this header file must not be included directly" |
| 3 |
#endif |
| 4 |
|
| 5 |
/* Error objects */ |
| 6 |
|
| 7 |
/* PyException_HEAD defines the initial segment of every exception class. */ |
| 8 |
#define PyException_HEAD PyObject_HEAD PyObject *dict;\ |
| 9 |
PyObject *args; PyObject *notes; PyObject *traceback;\ |
| 10 |
PyObject *context; PyObject *cause;\ |
| 11 |
char suppress_context; |
| 12 |
|
| 13 |
typedef struct { |
| 14 |
PyException_HEAD |
| 15 |
} PyBaseExceptionObject; |
| 16 |
|
| 17 |
typedef struct { |
| 18 |
PyException_HEAD |
| 19 |
PyObject *msg; |
| 20 |
PyObject *excs; |
| 21 |
PyObject *excs_str; |
| 22 |
} PyBaseExceptionGroupObject; |
| 23 |
|
| 24 |
typedef struct { |
| 25 |
PyException_HEAD |
| 26 |
PyObject *msg; |
| 27 |
PyObject *filename; |
| 28 |
PyObject *lineno; |
| 29 |
PyObject *offset; |
| 30 |
PyObject *end_lineno; |
| 31 |
PyObject *end_offset; |
| 32 |
PyObject *text; |
| 33 |
PyObject *print_file_and_line; |
| 34 |
PyObject *metadata; |
| 35 |
} PySyntaxErrorObject; |
| 36 |
|
| 37 |
typedef struct { |
| 38 |
PyException_HEAD |
| 39 |
PyObject *msg; |
| 40 |
PyObject *name; |
| 41 |
PyObject *path; |
| 42 |
PyObject *name_from; |
| 43 |
} PyImportErrorObject; |
| 44 |
|
| 45 |
typedef struct { |
| 46 |
PyException_HEAD |
| 47 |
PyObject *encoding; |
| 48 |
PyObject *object; |
| 49 |
Py_ssize_t start; |
| 50 |
Py_ssize_t end; |
| 51 |
PyObject *reason; |
| 52 |
} PyUnicodeErrorObject; |
| 53 |
|
| 54 |
typedef struct { |
| 55 |
PyException_HEAD |
| 56 |
PyObject *code; |
| 57 |
} PySystemExitObject; |
| 58 |
|
| 59 |
typedef struct { |
| 60 |
PyException_HEAD |
| 61 |
PyObject *myerrno; |
| 62 |
PyObject *strerror; |
| 63 |
PyObject *filename; |
| 64 |
PyObject *filename2; |
| 65 |
#ifdef MS_WINDOWS |
| 66 |
PyObject *winerror; |
| 67 |
#endif |
| 68 |
Py_ssize_t written; /* only for BlockingIOError, -1 otherwise */ |
| 69 |
} PyOSErrorObject; |
| 70 |
|
| 71 |
typedef struct { |
| 72 |
PyException_HEAD |
| 73 |
PyObject *value; |
| 74 |
} PyStopIterationObject; |
| 75 |
|
| 76 |
typedef struct { |
| 77 |
PyException_HEAD |
| 78 |
PyObject *name; |
| 79 |
} PyNameErrorObject; |
| 80 |
|
| 81 |
typedef struct { |
| 82 |
PyException_HEAD |
| 83 |
PyObject *obj; |
| 84 |
PyObject *name; |
| 85 |
} PyAttributeErrorObject; |
| 86 |
|
| 87 |
/* Compatibility typedefs */ |
| 88 |
typedef PyOSErrorObject PyEnvironmentErrorObject; |
| 89 |
#ifdef MS_WINDOWS |
| 90 |
typedef PyOSErrorObject PyWindowsErrorObject; |
| 91 |
#endif |
| 92 |
|
| 93 |
/* Context manipulation (PEP 3134) */ |
| 94 |
|
| 95 |
PyAPI_FUNC(void) _PyErr_ChainExceptions1(PyObject *); |
| 96 |
|
| 97 |
/* In exceptions.c */ |
| 98 |
|
| 99 |
PyAPI_FUNC(PyObject*) PyUnstable_Exc_PrepReraiseStar( |
| 100 |
PyObject *orig, |
| 101 |
PyObject *excs); |
| 102 |
|
| 103 |
/* In signalmodule.c */ |
| 104 |
|
| 105 |
PyAPI_FUNC(int) PySignal_SetWakeupFd(int fd); |
| 106 |
|
| 107 |
/* Support for adding program text to SyntaxErrors */ |
| 108 |
|
| 109 |
PyAPI_FUNC(void) PyErr_SyntaxLocationObject( |
| 110 |
PyObject *filename, |
| 111 |
int lineno, |
| 112 |
int col_offset); |
| 113 |
|
| 114 |
PyAPI_FUNC(void) PyErr_RangedSyntaxLocationObject( |
| 115 |
PyObject *filename, |
| 116 |
int lineno, |
| 117 |
int col_offset, |
| 118 |
int end_lineno, |
| 119 |
int end_col_offset); |
| 120 |
|
| 121 |
PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject( |
| 122 |
PyObject *filename, |
| 123 |
int lineno); |
| 124 |
|
| 125 |
PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalErrorFunc( |
| 126 |
const char *func, |
| 127 |
const char *message); |
| 128 |
|
| 129 |
PyAPI_FUNC(void) PyErr_FormatUnraisable(const char *, ...); |
| 130 |
|
| 131 |
PyAPI_DATA(PyObject *) PyExc_PythonFinalizationError; |
| 132 |
|
| 133 |
#define Py_FatalError(message) _Py_FatalErrorFunc(__func__, (message)) |