Debian Codegraph @

Include/cpython/pyerrors.h

raw
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 } PySyntaxErrorObject;
35
36 typedef struct {
37 PyException_HEAD
38 PyObject *msg;
39 PyObject *name;
40 PyObject *path;
41 PyObject *name_from;
42 } PyImportErrorObject;
43
44 typedef struct {
45 PyException_HEAD
46 PyObject *encoding;
47 PyObject *object;
48 Py_ssize_t start;
49 Py_ssize_t end;
50 PyObject *reason;
51 } PyUnicodeErrorObject;
52
53 typedef struct {
54 PyException_HEAD
55 PyObject *code;
56 } PySystemExitObject;
57
58 typedef struct {
59 PyException_HEAD
60 PyObject *myerrno;
61 PyObject *strerror;
62 PyObject *filename;
63 PyObject *filename2;
64 #ifdef MS_WINDOWS
65 PyObject *winerror;
66 #endif
67 Py_ssize_t written; /* only for BlockingIOError, -1 otherwise */
68 } PyOSErrorObject;
69
70 typedef struct {
71 PyException_HEAD
72 PyObject *value;
73 } PyStopIterationObject;
74
75 typedef struct {
76 PyException_HEAD
77 PyObject *name;
78 } PyNameErrorObject;
79
80 typedef struct {
81 PyException_HEAD
82 PyObject *obj;
83 PyObject *name;
84 } PyAttributeErrorObject;
85
86 /* Compatibility typedefs */
87 typedef PyOSErrorObject PyEnvironmentErrorObject;
88 #ifdef MS_WINDOWS
89 typedef PyOSErrorObject PyWindowsErrorObject;
90 #endif
91
92 /* Context manipulation (PEP 3134) */
93
94 PyAPI_FUNC(void) _PyErr_ChainExceptions1(PyObject *);
95
96 /* In exceptions.c */
97
98 PyAPI_FUNC(PyObject*) PyUnstable_Exc_PrepReraiseStar(
99 PyObject *orig,
100 PyObject *excs);
101
102 /* In signalmodule.c */
103
104 PyAPI_FUNC(int) PySignal_SetWakeupFd(int fd);
105
106 /* Support for adding program text to SyntaxErrors */
107
108 PyAPI_FUNC(void) PyErr_SyntaxLocationObject(
109 PyObject *filename,
110 int lineno,
111 int col_offset);
112
113 PyAPI_FUNC(void) PyErr_RangedSyntaxLocationObject(
114 PyObject *filename,
115 int lineno,
116 int col_offset,
117 int end_lineno,
118 int end_col_offset);
119
120 PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject(
121 PyObject *filename,
122 int lineno);
123
124 PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalErrorFunc(
125 const char *func,
126 const char *message);
127
128 PyAPI_FUNC(void) PyErr_FormatUnraisable(const char *, ...);
129
130 PyAPI_DATA(PyObject *) PyExc_PythonFinalizationError;
131
132 #define Py_FatalError(message) _Py_FatalErrorFunc(__func__, (message))