1use crate::object::*;
2use crate::pyport::Py_ssize_t;
3use core::ffi::{c_char, c_int};
4
5extern_libpython! {
6 #[cfg_attr(PyPy, link_name = "PyPyErr_SetNone")]
7 pub fn PyErr_SetNone(arg1: *mut PyObject);
8 #[cfg_attr(PyPy, link_name = "PyPyErr_SetObject")]
9 pub fn PyErr_SetObject(arg1: *mut PyObject, arg2: *mut PyObject);
10 #[cfg_attr(PyPy, link_name = "PyPyErr_SetString")]
11 pub fn PyErr_SetString(exception: *mut PyObject, string: *const c_char);
12 #[cfg_attr(PyPy, link_name = "PyPyErr_Occurred")]
13 pub fn PyErr_Occurred() -> *mut PyObject;
14 #[cfg_attr(PyPy, link_name = "PyPyErr_Clear")]
15 pub fn PyErr_Clear();
16 #[cfg_attr(Py_3_12, deprecated(note = "Use PyErr_GetRaisedException() instead."))]
17 #[cfg_attr(PyPy, link_name = "PyPyErr_Fetch")]
18 pub fn PyErr_Fetch(
19 arg1: *mut *mut PyObject,
20 arg2: *mut *mut PyObject,
21 arg3: *mut *mut PyObject,
22 );
23 #[cfg_attr(Py_3_12, deprecated(note = "Use PyErr_SetRaisedException() instead."))]
24 #[cfg_attr(PyPy, link_name = "PyPyErr_Restore")]
25 pub fn PyErr_Restore(arg1: *mut PyObject, arg2: *mut PyObject, arg3: *mut PyObject);
26 #[cfg_attr(PyPy, link_name = "PyPyErr_GetExcInfo")]
27 pub fn PyErr_GetExcInfo(
28 arg1: *mut *mut PyObject,
29 arg2: *mut *mut PyObject,
30 arg3: *mut *mut PyObject,
31 );
32 #[cfg_attr(PyPy, link_name = "PyPyErr_SetExcInfo")]
33 pub fn PyErr_SetExcInfo(arg1: *mut PyObject, arg2: *mut PyObject, arg3: *mut PyObject);
34 #[cfg_attr(PyPy, link_name = "PyPy_FatalError")]
35 pub fn Py_FatalError(message: *const c_char) -> !;
36 #[cfg_attr(PyPy, link_name = "PyPyErr_GivenExceptionMatches")]
37 pub fn PyErr_GivenExceptionMatches(arg1: *mut PyObject, arg2: *mut PyObject) -> c_int;
38 #[cfg_attr(PyPy, link_name = "PyPyErr_ExceptionMatches")]
39 pub fn PyErr_ExceptionMatches(arg1: *mut PyObject) -> c_int;
40 #[cfg_attr(
41 Py_3_12,
42 deprecated(
43 note = "Use PyErr_GetRaisedException() instead, to avoid any possible de-normalization."
44 )
45 )]
46 #[cfg_attr(PyPy, link_name = "PyPyErr_NormalizeException")]
47 pub fn PyErr_NormalizeException(
48 arg1: *mut *mut PyObject,
49 arg2: *mut *mut PyObject,
50 arg3: *mut *mut PyObject,
51 );
52 #[cfg(Py_3_12)]
53 pub fn PyErr_GetRaisedException() -> *mut PyObject;
54 #[cfg(Py_3_12)]
55 pub fn PyErr_SetRaisedException(exc: *mut PyObject);
56 #[cfg(Py_3_11)]
57 #[cfg_attr(PyPy, link_name = "PyPyErr_GetHandledException")]
58 pub fn PyErr_GetHandledException() -> *mut PyObject;
59 #[cfg(Py_3_11)]
60 #[cfg_attr(PyPy, link_name = "PyPyErr_SetHandledException")]
61 pub fn PyErr_SetHandledException(exc: *mut PyObject);
62 #[cfg_attr(PyPy, link_name = "PyPyException_SetTraceback")]
63 pub fn PyException_SetTraceback(arg1: *mut PyObject, arg2: *mut PyObject) -> c_int;
64 #[cfg_attr(PyPy, link_name = "PyPyException_GetTraceback")]
65 pub fn PyException_GetTraceback(arg1: *mut PyObject) -> *mut PyObject;
66 #[cfg_attr(PyPy, link_name = "PyPyException_GetCause")]
67 pub fn PyException_GetCause(arg1: *mut PyObject) -> *mut PyObject;
68 #[cfg_attr(PyPy, link_name = "PyPyException_SetCause")]
69 pub fn PyException_SetCause(arg1: *mut PyObject, arg2: *mut PyObject);
70 #[cfg_attr(PyPy, link_name = "PyPyException_GetContext")]
71 pub fn PyException_GetContext(arg1: *mut PyObject) -> *mut PyObject;
72 #[cfg_attr(PyPy, link_name = "PyPyException_SetContext")]
73 pub fn PyException_SetContext(arg1: *mut PyObject, arg2: *mut PyObject);
74
75 #[cfg(RustPython)]
76 pub fn PyExceptionClass_Check(x: *mut PyObject) -> c_int;
77 #[cfg(RustPython)]
78 pub fn PyExceptionInstance_Check(x: *mut PyObject) -> c_int;
79
80 #[cfg(PyPy)]
81 #[link_name = "PyPyExceptionInstance_Class"]
82 pub fn PyExceptionInstance_Class(x: *mut PyObject) -> *mut PyObject;
83}
84
85#[inline]
86#[cfg(not(RustPython))]
87pub unsafe fn PyExceptionClass_Check(x: *mut PyObject) -> c_int {
88 (PyType_Check(x) != 0
89 && PyType_FastSubclass(x as *mut PyTypeObject, Py_TPFLAGS_BASE_EXC_SUBCLASS) != 0)
90 as c_int
91}
92
93#[inline]
94#[cfg(not(RustPython))]
95pub unsafe fn PyExceptionInstance_Check(x: *mut PyObject) -> c_int {
96 PyType_FastSubclass(Py_TYPE(x), Py_TPFLAGS_BASE_EXC_SUBCLASS)
97}
98
99#[inline]
100#[cfg(not(PyPy))]
101pub unsafe fn PyExceptionInstance_Class(x: *mut PyObject) -> *mut PyObject {
102 Py_TYPE(x) as *mut PyObject
103}
104
105#[cfg(PyPy)]
107pub unsafe fn PyUnicodeDecodeError_Create(
108 encoding: *const c_char,
109 object: *const c_char,
110 length: Py_ssize_t,
111 start: Py_ssize_t,
112 end: Py_ssize_t,
113 reason: *const c_char,
114) -> *mut PyObject {
115 crate::_PyObject_CallFunction_SizeT(
116 PyExc_UnicodeDecodeError,
117 c"sy#nns".as_ptr(),
118 encoding,
119 object,
120 length,
121 start,
122 end,
123 reason,
124 )
125}
126
127extern_libpython! {
128 #[cfg_attr(PyPy, link_name = "PyPyExc_BaseException")]
129 pub static mut PyExc_BaseException: *mut PyObject;
130 #[cfg(Py_3_11)]
131 #[cfg_attr(PyPy, link_name = "PyPyExc_BaseExceptionGroup")]
132 pub static mut PyExc_BaseExceptionGroup: *mut PyObject;
133 #[cfg_attr(PyPy, link_name = "PyPyExc_Exception")]
134 pub static mut PyExc_Exception: *mut PyObject;
135 #[cfg_attr(PyPy, link_name = "PyPyExc_StopAsyncIteration")]
136 pub static mut PyExc_StopAsyncIteration: *mut PyObject;
137
138 #[cfg_attr(PyPy, link_name = "PyPyExc_StopIteration")]
139 pub static mut PyExc_StopIteration: *mut PyObject;
140 #[cfg_attr(PyPy, link_name = "PyPyExc_GeneratorExit")]
141 pub static mut PyExc_GeneratorExit: *mut PyObject;
142 #[cfg_attr(PyPy, link_name = "PyPyExc_ArithmeticError")]
143 pub static mut PyExc_ArithmeticError: *mut PyObject;
144 #[cfg_attr(PyPy, link_name = "PyPyExc_LookupError")]
145 pub static mut PyExc_LookupError: *mut PyObject;
146
147 #[cfg_attr(PyPy, link_name = "PyPyExc_AssertionError")]
148 pub static mut PyExc_AssertionError: *mut PyObject;
149 #[cfg_attr(PyPy, link_name = "PyPyExc_AttributeError")]
150 pub static mut PyExc_AttributeError: *mut PyObject;
151 #[cfg_attr(PyPy, link_name = "PyPyExc_BufferError")]
152 pub static mut PyExc_BufferError: *mut PyObject;
153 #[cfg_attr(PyPy, link_name = "PyPyExc_EOFError")]
154 pub static mut PyExc_EOFError: *mut PyObject;
155 #[cfg_attr(PyPy, link_name = "PyPyExc_FloatingPointError")]
156 pub static mut PyExc_FloatingPointError: *mut PyObject;
157 #[cfg_attr(PyPy, link_name = "PyPyExc_OSError")]
158 pub static mut PyExc_OSError: *mut PyObject;
159 #[cfg_attr(PyPy, link_name = "PyPyExc_ImportError")]
160 pub static mut PyExc_ImportError: *mut PyObject;
161 #[cfg_attr(PyPy, link_name = "PyPyExc_ModuleNotFoundError")]
162 pub static mut PyExc_ModuleNotFoundError: *mut PyObject;
163 #[cfg_attr(PyPy, link_name = "PyPyExc_IndexError")]
164 pub static mut PyExc_IndexError: *mut PyObject;
165 #[cfg_attr(PyPy, link_name = "PyPyExc_KeyError")]
166 pub static mut PyExc_KeyError: *mut PyObject;
167 #[cfg_attr(PyPy, link_name = "PyPyExc_KeyboardInterrupt")]
168 pub static mut PyExc_KeyboardInterrupt: *mut PyObject;
169 #[cfg_attr(PyPy, link_name = "PyPyExc_MemoryError")]
170 pub static mut PyExc_MemoryError: *mut PyObject;
171 #[cfg_attr(PyPy, link_name = "PyPyExc_NameError")]
172 pub static mut PyExc_NameError: *mut PyObject;
173 #[cfg_attr(PyPy, link_name = "PyPyExc_OverflowError")]
174 pub static mut PyExc_OverflowError: *mut PyObject;
175 #[cfg_attr(PyPy, link_name = "PyPyExc_RuntimeError")]
176 pub static mut PyExc_RuntimeError: *mut PyObject;
177 #[cfg_attr(PyPy, link_name = "PyPyExc_RecursionError")]
178 pub static mut PyExc_RecursionError: *mut PyObject;
179 #[cfg_attr(PyPy, link_name = "PyPyExc_NotImplementedError")]
180 pub static mut PyExc_NotImplementedError: *mut PyObject;
181 #[cfg_attr(PyPy, link_name = "PyPyExc_SyntaxError")]
182 pub static mut PyExc_SyntaxError: *mut PyObject;
183 #[cfg_attr(PyPy, link_name = "PyPyExc_IndentationError")]
184 pub static mut PyExc_IndentationError: *mut PyObject;
185 #[cfg_attr(PyPy, link_name = "PyPyExc_TabError")]
186 pub static mut PyExc_TabError: *mut PyObject;
187 #[cfg_attr(PyPy, link_name = "PyPyExc_ReferenceError")]
188 pub static mut PyExc_ReferenceError: *mut PyObject;
189 #[cfg_attr(PyPy, link_name = "PyPyExc_SystemError")]
190 pub static mut PyExc_SystemError: *mut PyObject;
191 #[cfg_attr(PyPy, link_name = "PyPyExc_SystemExit")]
192 pub static mut PyExc_SystemExit: *mut PyObject;
193 #[cfg_attr(PyPy, link_name = "PyPyExc_TypeError")]
194 pub static mut PyExc_TypeError: *mut PyObject;
195 #[cfg_attr(PyPy, link_name = "PyPyExc_UnboundLocalError")]
196 pub static mut PyExc_UnboundLocalError: *mut PyObject;
197 #[cfg_attr(PyPy, link_name = "PyPyExc_UnicodeError")]
198 pub static mut PyExc_UnicodeError: *mut PyObject;
199 #[cfg_attr(PyPy, link_name = "PyPyExc_UnicodeEncodeError")]
200 pub static mut PyExc_UnicodeEncodeError: *mut PyObject;
201 #[cfg_attr(PyPy, link_name = "PyPyExc_UnicodeDecodeError")]
202 pub static mut PyExc_UnicodeDecodeError: *mut PyObject;
203 #[cfg_attr(PyPy, link_name = "PyPyExc_UnicodeTranslateError")]
204 pub static mut PyExc_UnicodeTranslateError: *mut PyObject;
205 #[cfg_attr(PyPy, link_name = "PyPyExc_ValueError")]
206 pub static mut PyExc_ValueError: *mut PyObject;
207 #[cfg_attr(PyPy, link_name = "PyPyExc_ZeroDivisionError")]
208 pub static mut PyExc_ZeroDivisionError: *mut PyObject;
209
210 #[cfg_attr(PyPy, link_name = "PyPyExc_BlockingIOError")]
211 pub static mut PyExc_BlockingIOError: *mut PyObject;
212 #[cfg_attr(PyPy, link_name = "PyPyExc_BrokenPipeError")]
213 pub static mut PyExc_BrokenPipeError: *mut PyObject;
214 #[cfg_attr(PyPy, link_name = "PyPyExc_ChildProcessError")]
215 pub static mut PyExc_ChildProcessError: *mut PyObject;
216 #[cfg_attr(PyPy, link_name = "PyPyExc_ConnectionError")]
217 pub static mut PyExc_ConnectionError: *mut PyObject;
218 #[cfg_attr(PyPy, link_name = "PyPyExc_ConnectionAbortedError")]
219 pub static mut PyExc_ConnectionAbortedError: *mut PyObject;
220 #[cfg_attr(PyPy, link_name = "PyPyExc_ConnectionRefusedError")]
221 pub static mut PyExc_ConnectionRefusedError: *mut PyObject;
222 #[cfg_attr(PyPy, link_name = "PyPyExc_ConnectionResetError")]
223 pub static mut PyExc_ConnectionResetError: *mut PyObject;
224 #[cfg_attr(PyPy, link_name = "PyPyExc_FileExistsError")]
225 pub static mut PyExc_FileExistsError: *mut PyObject;
226 #[cfg_attr(PyPy, link_name = "PyPyExc_FileNotFoundError")]
227 pub static mut PyExc_FileNotFoundError: *mut PyObject;
228 #[cfg_attr(PyPy, link_name = "PyPyExc_InterruptedError")]
229 pub static mut PyExc_InterruptedError: *mut PyObject;
230 #[cfg_attr(PyPy, link_name = "PyPyExc_IsADirectoryError")]
231 pub static mut PyExc_IsADirectoryError: *mut PyObject;
232 #[cfg_attr(PyPy, link_name = "PyPyExc_NotADirectoryError")]
233 pub static mut PyExc_NotADirectoryError: *mut PyObject;
234 #[cfg_attr(PyPy, link_name = "PyPyExc_PermissionError")]
235 pub static mut PyExc_PermissionError: *mut PyObject;
236 #[cfg_attr(PyPy, link_name = "PyPyExc_ProcessLookupError")]
237 pub static mut PyExc_ProcessLookupError: *mut PyObject;
238 #[cfg_attr(PyPy, link_name = "PyPyExc_TimeoutError")]
239 pub static mut PyExc_TimeoutError: *mut PyObject;
240
241 #[cfg_attr(PyPy, link_name = "PyPyExc_OSError")]
242 pub static mut PyExc_EnvironmentError: *mut PyObject;
243 #[cfg_attr(PyPy, link_name = "PyPyExc_OSError")]
244 pub static mut PyExc_IOError: *mut PyObject;
245 #[cfg(windows)]
246 #[cfg_attr(PyPy, link_name = "PyPyExc_OSError")]
247 pub static mut PyExc_WindowsError: *mut PyObject;
248
249 pub static mut PyExc_RecursionErrorInst: *mut PyObject;
250
251 #[cfg_attr(PyPy, link_name = "PyPyExc_Warning")]
253 pub static mut PyExc_Warning: *mut PyObject;
254 #[cfg_attr(PyPy, link_name = "PyPyExc_UserWarning")]
255 pub static mut PyExc_UserWarning: *mut PyObject;
256 #[cfg_attr(PyPy, link_name = "PyPyExc_DeprecationWarning")]
257 pub static mut PyExc_DeprecationWarning: *mut PyObject;
258 #[cfg_attr(PyPy, link_name = "PyPyExc_PendingDeprecationWarning")]
259 pub static mut PyExc_PendingDeprecationWarning: *mut PyObject;
260 #[cfg_attr(PyPy, link_name = "PyPyExc_SyntaxWarning")]
261 pub static mut PyExc_SyntaxWarning: *mut PyObject;
262 #[cfg_attr(PyPy, link_name = "PyPyExc_RuntimeWarning")]
263 pub static mut PyExc_RuntimeWarning: *mut PyObject;
264 #[cfg_attr(PyPy, link_name = "PyPyExc_FutureWarning")]
265 pub static mut PyExc_FutureWarning: *mut PyObject;
266 #[cfg_attr(PyPy, link_name = "PyPyExc_ImportWarning")]
267 pub static mut PyExc_ImportWarning: *mut PyObject;
268 #[cfg_attr(PyPy, link_name = "PyPyExc_UnicodeWarning")]
269 pub static mut PyExc_UnicodeWarning: *mut PyObject;
270 #[cfg_attr(PyPy, link_name = "PyPyExc_BytesWarning")]
271 pub static mut PyExc_BytesWarning: *mut PyObject;
272 #[cfg_attr(PyPy, link_name = "PyPyExc_ResourceWarning")]
273 pub static mut PyExc_ResourceWarning: *mut PyObject;
274 #[cfg(Py_3_10)]
275 #[cfg_attr(PyPy, link_name = "PyPyExc_EncodingWarning")]
276 pub static mut PyExc_EncodingWarning: *mut PyObject;
277}
278
279extern_libpython! {
280 #[cfg_attr(PyPy, link_name = "PyPyErr_BadArgument")]
281 pub fn PyErr_BadArgument() -> c_int;
282 #[cfg_attr(PyPy, link_name = "PyPyErr_NoMemory")]
283 pub fn PyErr_NoMemory() -> *mut PyObject;
284 #[cfg_attr(PyPy, link_name = "PyPyErr_SetFromErrno")]
285 pub fn PyErr_SetFromErrno(arg1: *mut PyObject) -> *mut PyObject;
286 #[cfg_attr(PyPy, link_name = "PyPyErr_SetFromErrnoWithFilenameObject")]
287 pub fn PyErr_SetFromErrnoWithFilenameObject(
288 arg1: *mut PyObject,
289 arg2: *mut PyObject,
290 ) -> *mut PyObject;
291 pub fn PyErr_SetFromErrnoWithFilenameObjects(
292 arg1: *mut PyObject,
293 arg2: *mut PyObject,
294 arg3: *mut PyObject,
295 ) -> *mut PyObject;
296 pub fn PyErr_SetFromErrnoWithFilename(
297 exc: *mut PyObject,
298 filename: *const c_char,
299 ) -> *mut PyObject;
300 #[cfg_attr(PyPy, link_name = "PyPyErr_Format")]
301 pub fn PyErr_Format(exception: *mut PyObject, format: *const c_char, ...) -> *mut PyObject;
302 pub fn PyErr_SetImportErrorSubclass(
303 arg1: *mut PyObject,
304 arg2: *mut PyObject,
305 arg3: *mut PyObject,
306 arg4: *mut PyObject,
307 ) -> *mut PyObject;
308 pub fn PyErr_SetImportError(
309 arg1: *mut PyObject,
310 arg2: *mut PyObject,
311 arg3: *mut PyObject,
312 ) -> *mut PyObject;
313 #[cfg_attr(PyPy, link_name = "PyPyErr_BadInternalCall")]
314 pub fn PyErr_BadInternalCall();
315 pub fn _PyErr_BadInternalCall(filename: *const c_char, lineno: c_int);
316 #[cfg_attr(PyPy, link_name = "PyPyErr_NewException")]
317 pub fn PyErr_NewException(
318 name: *const c_char,
319 base: *mut PyObject,
320 dict: *mut PyObject,
321 ) -> *mut PyObject;
322 #[cfg_attr(PyPy, link_name = "PyPyErr_NewExceptionWithDoc")]
323 pub fn PyErr_NewExceptionWithDoc(
324 name: *const c_char,
325 doc: *const c_char,
326 base: *mut PyObject,
327 dict: *mut PyObject,
328 ) -> *mut PyObject;
329 #[cfg_attr(PyPy, link_name = "PyPyErr_WriteUnraisable")]
330 pub fn PyErr_WriteUnraisable(arg1: *mut PyObject);
331 #[cfg_attr(PyPy, link_name = "PyPyErr_CheckSignals")]
332 pub fn PyErr_CheckSignals() -> c_int;
333 #[cfg_attr(PyPy, link_name = "PyPyErr_SetInterrupt")]
334 pub fn PyErr_SetInterrupt();
335 #[cfg(Py_3_10)]
336 #[cfg_attr(PyPy, link_name = "PyPyErr_SetInterruptEx")]
337 pub fn PyErr_SetInterruptEx(signum: c_int) -> c_int;
338 #[cfg_attr(PyPy, link_name = "PyPyErr_SyntaxLocation")]
339 pub fn PyErr_SyntaxLocation(filename: *const c_char, lineno: c_int);
340 #[cfg_attr(PyPy, link_name = "PyPyErr_SyntaxLocationEx")]
341 pub fn PyErr_SyntaxLocationEx(filename: *const c_char, lineno: c_int, col_offset: c_int);
342 #[cfg_attr(PyPy, link_name = "PyPyErr_ProgramText")]
343 pub fn PyErr_ProgramText(filename: *const c_char, lineno: c_int) -> *mut PyObject;
344 #[cfg(not(PyPy))]
345 pub fn PyUnicodeDecodeError_Create(
346 encoding: *const c_char,
347 object: *const c_char,
348 length: Py_ssize_t,
349 start: Py_ssize_t,
350 end: Py_ssize_t,
351 reason: *const c_char,
352 ) -> *mut PyObject;
353 pub fn PyUnicodeEncodeError_GetEncoding(arg1: *mut PyObject) -> *mut PyObject;
354 pub fn PyUnicodeDecodeError_GetEncoding(arg1: *mut PyObject) -> *mut PyObject;
355 pub fn PyUnicodeEncodeError_GetObject(arg1: *mut PyObject) -> *mut PyObject;
356 pub fn PyUnicodeDecodeError_GetObject(arg1: *mut PyObject) -> *mut PyObject;
357 pub fn PyUnicodeTranslateError_GetObject(arg1: *mut PyObject) -> *mut PyObject;
358 pub fn PyUnicodeEncodeError_GetStart(arg1: *mut PyObject, arg2: *mut Py_ssize_t) -> c_int;
359 pub fn PyUnicodeDecodeError_GetStart(arg1: *mut PyObject, arg2: *mut Py_ssize_t) -> c_int;
360 pub fn PyUnicodeTranslateError_GetStart(arg1: *mut PyObject, arg2: *mut Py_ssize_t) -> c_int;
361 pub fn PyUnicodeEncodeError_SetStart(arg1: *mut PyObject, arg2: Py_ssize_t) -> c_int;
362 pub fn PyUnicodeDecodeError_SetStart(arg1: *mut PyObject, arg2: Py_ssize_t) -> c_int;
363 pub fn PyUnicodeTranslateError_SetStart(arg1: *mut PyObject, arg2: Py_ssize_t) -> c_int;
364 pub fn PyUnicodeEncodeError_GetEnd(arg1: *mut PyObject, arg2: *mut Py_ssize_t) -> c_int;
365 pub fn PyUnicodeDecodeError_GetEnd(arg1: *mut PyObject, arg2: *mut Py_ssize_t) -> c_int;
366 pub fn PyUnicodeTranslateError_GetEnd(arg1: *mut PyObject, arg2: *mut Py_ssize_t) -> c_int;
367 pub fn PyUnicodeEncodeError_SetEnd(arg1: *mut PyObject, arg2: Py_ssize_t) -> c_int;
368 pub fn PyUnicodeDecodeError_SetEnd(arg1: *mut PyObject, arg2: Py_ssize_t) -> c_int;
369 pub fn PyUnicodeTranslateError_SetEnd(arg1: *mut PyObject, arg2: Py_ssize_t) -> c_int;
370 pub fn PyUnicodeEncodeError_GetReason(arg1: *mut PyObject) -> *mut PyObject;
371 pub fn PyUnicodeDecodeError_GetReason(arg1: *mut PyObject) -> *mut PyObject;
372 pub fn PyUnicodeTranslateError_GetReason(arg1: *mut PyObject) -> *mut PyObject;
373 pub fn PyUnicodeEncodeError_SetReason(exc: *mut PyObject, reason: *const c_char) -> c_int;
374 pub fn PyUnicodeDecodeError_SetReason(exc: *mut PyObject, reason: *const c_char) -> c_int;
375 pub fn PyUnicodeTranslateError_SetReason(exc: *mut PyObject, reason: *const c_char) -> c_int;
376}