Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/python3.8/cpython/pyerrors.h @ 69:33d812a61356
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 17:55:14 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 69:33d812a61356 |
---|---|
1 #ifndef Py_CPYTHON_ERRORS_H | |
2 # error "this header file must not be included directly" | |
3 #endif | |
4 | |
5 #ifdef __cplusplus | |
6 extern "C" { | |
7 #endif | |
8 | |
9 /* Error objects */ | |
10 | |
11 /* PyException_HEAD defines the initial segment of every exception class. */ | |
12 #define PyException_HEAD PyObject_HEAD PyObject *dict;\ | |
13 PyObject *args; PyObject *traceback;\ | |
14 PyObject *context; PyObject *cause;\ | |
15 char suppress_context; | |
16 | |
17 typedef struct { | |
18 PyException_HEAD | |
19 } PyBaseExceptionObject; | |
20 | |
21 typedef struct { | |
22 PyException_HEAD | |
23 PyObject *msg; | |
24 PyObject *filename; | |
25 PyObject *lineno; | |
26 PyObject *offset; | |
27 PyObject *text; | |
28 PyObject *print_file_and_line; | |
29 } PySyntaxErrorObject; | |
30 | |
31 typedef struct { | |
32 PyException_HEAD | |
33 PyObject *msg; | |
34 PyObject *name; | |
35 PyObject *path; | |
36 } PyImportErrorObject; | |
37 | |
38 typedef struct { | |
39 PyException_HEAD | |
40 PyObject *encoding; | |
41 PyObject *object; | |
42 Py_ssize_t start; | |
43 Py_ssize_t end; | |
44 PyObject *reason; | |
45 } PyUnicodeErrorObject; | |
46 | |
47 typedef struct { | |
48 PyException_HEAD | |
49 PyObject *code; | |
50 } PySystemExitObject; | |
51 | |
52 typedef struct { | |
53 PyException_HEAD | |
54 PyObject *myerrno; | |
55 PyObject *strerror; | |
56 PyObject *filename; | |
57 PyObject *filename2; | |
58 #ifdef MS_WINDOWS | |
59 PyObject *winerror; | |
60 #endif | |
61 Py_ssize_t written; /* only for BlockingIOError, -1 otherwise */ | |
62 } PyOSErrorObject; | |
63 | |
64 typedef struct { | |
65 PyException_HEAD | |
66 PyObject *value; | |
67 } PyStopIterationObject; | |
68 | |
69 /* Compatibility typedefs */ | |
70 typedef PyOSErrorObject PyEnvironmentErrorObject; | |
71 #ifdef MS_WINDOWS | |
72 typedef PyOSErrorObject PyWindowsErrorObject; | |
73 #endif | |
74 | |
75 /* Error handling definitions */ | |
76 | |
77 PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *); | |
78 _PyErr_StackItem *_PyErr_GetTopmostException(PyThreadState *tstate); | |
79 | |
80 /* Context manipulation (PEP 3134) */ | |
81 | |
82 PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *); | |
83 | |
84 /* */ | |
85 | |
86 #define PyExceptionClass_Name(x) (((PyTypeObject*)(x))->tp_name) | |
87 | |
88 /* Convenience functions */ | |
89 | |
90 #ifdef MS_WINDOWS | |
91 Py_DEPRECATED(3.3) | |
92 PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename( | |
93 PyObject *, const Py_UNICODE *); | |
94 #endif /* MS_WINDOWS */ | |
95 | |
96 /* Like PyErr_Format(), but saves current exception as __context__ and | |
97 __cause__. | |
98 */ | |
99 PyAPI_FUNC(PyObject *) _PyErr_FormatFromCause( | |
100 PyObject *exception, | |
101 const char *format, /* ASCII-encoded string */ | |
102 ... | |
103 ); | |
104 | |
105 #ifdef MS_WINDOWS | |
106 /* XXX redeclare to use WSTRING */ | |
107 Py_DEPRECATED(3.3) | |
108 PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename( | |
109 int, const Py_UNICODE *); | |
110 Py_DEPRECATED(3.3) | |
111 PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename( | |
112 PyObject *,int, const Py_UNICODE *); | |
113 #endif | |
114 | |
115 /* In exceptions.c */ | |
116 | |
117 /* Helper that attempts to replace the current exception with one of the | |
118 * same type but with a prefix added to the exception text. The resulting | |
119 * exception description looks like: | |
120 * | |
121 * prefix (exc_type: original_exc_str) | |
122 * | |
123 * Only some exceptions can be safely replaced. If the function determines | |
124 * it isn't safe to perform the replacement, it will leave the original | |
125 * unmodified exception in place. | |
126 * | |
127 * Returns a borrowed reference to the new exception (if any), NULL if the | |
128 * existing exception was left in place. | |
129 */ | |
130 PyAPI_FUNC(PyObject *) _PyErr_TrySetFromCause( | |
131 const char *prefix_format, /* ASCII-encoded string */ | |
132 ... | |
133 ); | |
134 | |
135 /* In signalmodule.c */ | |
136 | |
137 int PySignal_SetWakeupFd(int fd); | |
138 PyAPI_FUNC(int) _PyErr_CheckSignals(void); | |
139 | |
140 /* Support for adding program text to SyntaxErrors */ | |
141 | |
142 PyAPI_FUNC(void) PyErr_SyntaxLocationObject( | |
143 PyObject *filename, | |
144 int lineno, | |
145 int col_offset); | |
146 | |
147 PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject( | |
148 PyObject *filename, | |
149 int lineno); | |
150 | |
151 /* Create a UnicodeEncodeError object */ | |
152 Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create( | |
153 const char *encoding, /* UTF-8 encoded string */ | |
154 const Py_UNICODE *object, | |
155 Py_ssize_t length, | |
156 Py_ssize_t start, | |
157 Py_ssize_t end, | |
158 const char *reason /* UTF-8 encoded string */ | |
159 ); | |
160 | |
161 /* Create a UnicodeTranslateError object */ | |
162 Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create( | |
163 const Py_UNICODE *object, | |
164 Py_ssize_t length, | |
165 Py_ssize_t start, | |
166 Py_ssize_t end, | |
167 const char *reason /* UTF-8 encoded string */ | |
168 ); | |
169 PyAPI_FUNC(PyObject *) _PyUnicodeTranslateError_Create( | |
170 PyObject *object, | |
171 Py_ssize_t start, | |
172 Py_ssize_t end, | |
173 const char *reason /* UTF-8 encoded string */ | |
174 ); | |
175 | |
176 PyAPI_FUNC(void) _PyErr_WriteUnraisableMsg( | |
177 const char *err_msg, | |
178 PyObject *obj); | |
179 | |
180 #ifdef __cplusplus | |
181 } | |
182 #endif |