1use crate::object::*;
2use crate::pyport::Py_ssize_t;
3use std::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(PyPy)]
76 #[link_name = "PyPyExceptionInstance_Class"]
77 pub fn PyExceptionInstance_Class(x: *mut PyObject) -> *mut PyObject;
78}
79
80#[inline]
81pub unsafe fn PyExceptionClass_Check(x: *mut PyObject) -> c_int {
82 (PyType_Check(x) != 0
83 && PyType_FastSubclass(x as *mut PyTypeObject, Py_TPFLAGS_BASE_EXC_SUBCLASS) != 0)
84 as c_int
85}
86
87#[inline]
88pub unsafe fn PyExceptionInstance_Check(x: *mut PyObject) -> c_int {
89 PyType_FastSubclass(Py_TYPE(x), Py_TPFLAGS_BASE_EXC_SUBCLASS)
90}
91
92#[inline]
93#[cfg(not(PyPy))]
94pub unsafe fn PyExceptionInstance_Class(x: *mut PyObject) -> *mut PyObject {
95 Py_TYPE(x) as *mut PyObject
96}
97
98#[cfg(PyPy)]
100pub unsafe fn PyUnicodeDecodeError_Create(
101 encoding: *const c_char,
102 object: *const c_char,
103 length: Py_ssize_t,
104 start: Py_ssize_t,
105 end: Py_ssize_t,
106 reason: *const c_char,
107) -> *mut PyObject {
108 crate::_PyObject_CallFunction_SizeT(
109 PyExc_UnicodeDecodeError,
110 c"sy#nns".as_ptr(),
111 encoding,
112 object,
113 length,
114 start,
115 end,
116 reason,
117 )
118}
119
120extern_libpython! {
121 #[cfg_attr(PyPy, link_name = "PyPyExc_BaseException")]
122 pub static mut PyExc_BaseException: *mut PyObject;
123 #[cfg(Py_3_11)]
124 #[cfg_attr(PyPy, link_name = "PyPyExc_BaseExceptionGroup")]
125 pub static mut PyExc_BaseExceptionGroup: *mut PyObject;
126 #[cfg_attr(PyPy, link_name = "PyPyExc_Exception")]
127 pub static mut PyExc_Exception: *mut PyObject;
128 #[cfg_attr(PyPy, link_name = "PyPyExc_StopAsyncIteration")]
129 pub static mut PyExc_StopAsyncIteration: *mut PyObject;
130
131 #[cfg_attr(PyPy, link_name = "PyPyExc_StopIteration")]
132 pub static mut PyExc_StopIteration: *mut PyObject;
133 #[cfg_attr(PyPy, link_name = "PyPyExc_GeneratorExit")]
134 pub static mut PyExc_GeneratorExit: *mut PyObject;
135 #[cfg_attr(PyPy, link_name = "PyPyExc_ArithmeticError")]
136 pub static mut PyExc_ArithmeticError: *mut PyObject;
137 #[cfg_attr(PyPy, link_name = "PyPyExc_LookupError")]
138 pub static mut PyExc_LookupError: *mut PyObject;
139
140 #[cfg_attr(PyPy, link_name = "PyPyExc_AssertionError")]
141 pub static mut PyExc_AssertionError: *mut PyObject;
142 #[cfg_attr(PyPy, link_name = "PyPyExc_AttributeError")]
143 pub static mut PyExc_AttributeError: *mut PyObject;
144 #[cfg_attr(PyPy, link_name = "PyPyExc_BufferError")]
145 pub static mut PyExc_BufferError: *mut PyObject;
146 #[cfg_attr(PyPy, link_name = "PyPyExc_EOFError")]
147 pub static mut PyExc_EOFError: *mut PyObject;
148 #[cfg_attr(PyPy, link_name = "PyPyExc_FloatingPointError")]
149 pub static mut PyExc_FloatingPointError: *mut PyObject;
150 #[cfg_attr(PyPy, link_name = "PyPyExc_OSError")]
151 pub static mut PyExc_OSError: *mut PyObject;
152 #[cfg_attr(PyPy, link_name = "PyPyExc_ImportError")]
153 pub static mut PyExc_ImportError: *mut PyObject;
154 #[cfg_attr(PyPy, link_name = "PyPyExc_ModuleNotFoundError")]
155 pub static mut PyExc_ModuleNotFoundError: *mut PyObject;
156 #[cfg_attr(PyPy, link_name = "PyPyExc_IndexError")]
157 pub static mut PyExc_IndexError: *mut PyObject;
158 #[cfg_attr(PyPy, link_name = "PyPyExc_KeyError")]
159 pub static mut PyExc_KeyError: *mut PyObject;
160 #[cfg_attr(PyPy, link_name = "PyPyExc_KeyboardInterrupt")]
161 pub static mut PyExc_KeyboardInterrupt: *mut PyObject;
162 #[cfg_attr(PyPy, link_name = "PyPyExc_MemoryError")]
163 pub static mut PyExc_MemoryError: *mut PyObject;
164 #[cfg_attr(PyPy, link_name = "PyPyExc_NameError")]
165 pub static mut PyExc_NameError: *mut PyObject;
166 #[cfg_attr(PyPy, link_name = "PyPyExc_OverflowError")]
167 pub static mut PyExc_OverflowError: *mut PyObject;
168 #[cfg_attr(PyPy, link_name = "PyPyExc_RuntimeError")]
169 pub static mut PyExc_RuntimeError: *mut PyObject;
170 #[cfg_attr(PyPy, link_name = "PyPyExc_RecursionError")]
171 pub static mut PyExc_RecursionError: *mut PyObject;
172 #[cfg_attr(PyPy, link_name = "PyPyExc_NotImplementedError")]
173 pub static mut PyExc_NotImplementedError: *mut PyObject;
174 #[cfg_attr(PyPy, link_name = "PyPyExc_SyntaxError")]
175 pub static mut PyExc_SyntaxError: *mut PyObject;
176 #[cfg_attr(PyPy, link_name = "PyPyExc_IndentationError")]
177 pub static mut PyExc_IndentationError: *mut PyObject;
178 #[cfg_attr(PyPy, link_name = "PyPyExc_TabError")]
179 pub static mut PyExc_TabError: *mut PyObject;
180 #[cfg_attr(PyPy, link_name = "PyPyExc_ReferenceError")]
181 pub static mut PyExc_ReferenceError: *mut PyObject;
182 #[cfg_attr(PyPy, link_name = "PyPyExc_SystemError")]
183 pub static mut PyExc_SystemError: *mut PyObject;
184 #[cfg_attr(PyPy, link_name = "PyPyExc_SystemExit")]
185 pub static mut PyExc_SystemExit: *mut PyObject;
186 #[cfg_attr(PyPy, link_name = "PyPyExc_TypeError")]
187 pub static mut PyExc_TypeError: *mut PyObject;
188 #[cfg_attr(PyPy, link_name = "PyPyExc_UnboundLocalError")]
189 pub static mut PyExc_UnboundLocalError: *mut PyObject;
190 #[cfg_attr(PyPy, link_name = "PyPyExc_UnicodeError")]
191 pub static mut PyExc_UnicodeError: *mut PyObject;
192 #[cfg_attr(PyPy, link_name = "PyPyExc_UnicodeEncodeError")]
193 pub static mut PyExc_UnicodeEncodeError: *mut PyObject;
194 #[cfg_attr(PyPy, link_name = "PyPyExc_UnicodeDecodeError")]
195 pub static mut PyExc_UnicodeDecodeError: *mut PyObject;
196 #[cfg_attr(PyPy, link_name = "PyPyExc_UnicodeTranslateError")]
197 pub static mut PyExc_UnicodeTranslateError: *mut PyObject;
198 #[cfg_attr(PyPy, link_name = "PyPyExc_ValueError")]
199 pub static mut PyExc_ValueError: *mut PyObject;
200 #[cfg_attr(PyPy, link_name = "PyPyExc_ZeroDivisionError")]
201 pub static mut PyExc_ZeroDivisionError: *mut PyObject;
202
203 #[cfg_attr(PyPy, link_name = "PyPyExc_BlockingIOError")]
204 pub static mut PyExc_BlockingIOError: *mut PyObject;
205 #[cfg_attr(PyPy, link_name = "PyPyExc_BrokenPipeError")]
206 pub static mut PyExc_BrokenPipeError: *mut PyObject;
207 #[cfg_attr(PyPy, link_name = "PyPyExc_ChildProcessError")]
208 pub static mut PyExc_ChildProcessError: *mut PyObject;
209 #[cfg_attr(PyPy, link_name = "PyPyExc_ConnectionError")]
210 pub static mut PyExc_ConnectionError: *mut PyObject;
211 #[cfg_attr(PyPy, link_name = "PyPyExc_ConnectionAbortedError")]
212 pub static mut PyExc_ConnectionAbortedError: *mut PyObject;
213 #[cfg_attr(PyPy, link_name = "PyPyExc_ConnectionRefusedError")]
214 pub static mut PyExc_ConnectionRefusedError: *mut PyObject;
215 #[cfg_attr(PyPy, link_name = "PyPyExc_ConnectionResetError")]
216 pub static mut PyExc_ConnectionResetError: *mut PyObject;
217 #[cfg_attr(PyPy, link_name = "PyPyExc_FileExistsError")]
218 pub static mut PyExc_FileExistsError: *mut PyObject;
219 #[cfg_attr(PyPy, link_name = "PyPyExc_FileNotFoundError")]
220 pub static mut PyExc_FileNotFoundError: *mut PyObject;
221 #[cfg_attr(PyPy, link_name = "PyPyExc_InterruptedError")]
222 pub static mut PyExc_InterruptedError: *mut PyObject;
223 #[cfg_attr(PyPy, link_name = "PyPyExc_IsADirectoryError")]
224 pub static mut PyExc_IsADirectoryError: *mut PyObject;
225 #[cfg_attr(PyPy, link_name = "PyPyExc_NotADirectoryError")]
226 pub static mut PyExc_NotADirectoryError: *mut PyObject;
227 #[cfg_attr(PyPy, link_name = "PyPyExc_PermissionError")]
228 pub static mut PyExc_PermissionError: *mut PyObject;
229 #[cfg_attr(PyPy, link_name = "PyPyExc_ProcessLookupError")]
230 pub static mut PyExc_ProcessLookupError: *mut PyObject;
231 #[cfg_attr(PyPy, link_name = "PyPyExc_TimeoutError")]
232 pub static mut PyExc_TimeoutError: *mut PyObject;
233
234 #[cfg_attr(PyPy, link_name = "PyPyExc_OSError")]
235 pub static mut PyExc_EnvironmentError: *mut PyObject;
236 #[cfg_attr(PyPy, link_name = "PyPyExc_OSError")]
237 pub static mut PyExc_IOError: *mut PyObject;
238 #[cfg(windows)]
239 #[cfg_attr(PyPy, link_name = "PyPyExc_OSError")]
240 pub static mut PyExc_WindowsError: *mut PyObject;
241
242 pub static mut PyExc_RecursionErrorInst: *mut PyObject;
243
244 #[cfg_attr(PyPy, link_name = "PyPyExc_Warning")]
246 pub static mut PyExc_Warning: *mut PyObject;
247 #[cfg_attr(PyPy, link_name = "PyPyExc_UserWarning")]
248 pub static mut PyExc_UserWarning: *mut PyObject;
249 #[cfg_attr(PyPy, link_name = "PyPyExc_DeprecationWarning")]
250 pub static mut PyExc_DeprecationWarning: *mut PyObject;
251 #[cfg_attr(PyPy, link_name = "PyPyExc_PendingDeprecationWarning")]
252 pub static mut PyExc_PendingDeprecationWarning: *mut PyObject;
253 #[cfg_attr(PyPy, link_name = "PyPyExc_SyntaxWarning")]
254 pub static mut PyExc_SyntaxWarning: *mut PyObject;
255 #[cfg_attr(PyPy, link_name = "PyPyExc_RuntimeWarning")]
256 pub static mut PyExc_RuntimeWarning: *mut PyObject;
257 #[cfg_attr(PyPy, link_name = "PyPyExc_FutureWarning")]
258 pub static mut PyExc_FutureWarning: *mut PyObject;
259 #[cfg_attr(PyPy, link_name = "PyPyExc_ImportWarning")]
260 pub static mut PyExc_ImportWarning: *mut PyObject;
261 #[cfg_attr(PyPy, link_name = "PyPyExc_UnicodeWarning")]
262 pub static mut PyExc_UnicodeWarning: *mut PyObject;
263 #[cfg_attr(PyPy, link_name = "PyPyExc_BytesWarning")]
264 pub static mut PyExc_BytesWarning: *mut PyObject;
265 #[cfg_attr(PyPy, link_name = "PyPyExc_ResourceWarning")]
266 pub static mut PyExc_ResourceWarning: *mut PyObject;
267 #[cfg(Py_3_10)]
268 #[cfg_attr(PyPy, link_name = "PyPyExc_EncodingWarning")]
269 pub static mut PyExc_EncodingWarning: *mut PyObject;
270}
271
272extern_libpython! {
273 #[cfg_attr(PyPy, link_name = "PyPyErr_BadArgument")]
274 pub fn PyErr_BadArgument() -> c_int;
275 #[cfg_attr(PyPy, link_name = "PyPyErr_NoMemory")]
276 pub fn PyErr_NoMemory() -> *mut PyObject;
277 #[cfg_attr(PyPy, link_name = "PyPyErr_SetFromErrno")]
278 pub fn PyErr_SetFromErrno(arg1: *mut PyObject) -> *mut PyObject;
279 #[cfg_attr(PyPy, link_name = "PyPyErr_SetFromErrnoWithFilenameObject")]
280 pub fn PyErr_SetFromErrnoWithFilenameObject(
281 arg1: *mut PyObject,
282 arg2: *mut PyObject,
283 ) -> *mut PyObject;
284 pub fn PyErr_SetFromErrnoWithFilenameObjects(
285 arg1: *mut PyObject,
286 arg2: *mut PyObject,
287 arg3: *mut PyObject,
288 ) -> *mut PyObject;
289 pub fn PyErr_SetFromErrnoWithFilename(
290 exc: *mut PyObject,
291 filename: *const c_char,
292 ) -> *mut PyObject;
293 #[cfg_attr(PyPy, link_name = "PyPyErr_Format")]
294 pub fn PyErr_Format(exception: *mut PyObject, format: *const c_char, ...) -> *mut PyObject;
295 pub fn PyErr_SetImportErrorSubclass(
296 arg1: *mut PyObject,
297 arg2: *mut PyObject,
298 arg3: *mut PyObject,
299 arg4: *mut PyObject,
300 ) -> *mut PyObject;
301 pub fn PyErr_SetImportError(
302 arg1: *mut PyObject,
303 arg2: *mut PyObject,
304 arg3: *mut PyObject,
305 ) -> *mut PyObject;
306 #[cfg_attr(PyPy, link_name = "PyPyErr_BadInternalCall")]
307 pub fn PyErr_BadInternalCall();
308 pub fn _PyErr_BadInternalCall(filename: *const c_char, lineno: c_int);
309 #[cfg_attr(PyPy, link_name = "PyPyErr_NewException")]
310 pub fn PyErr_NewException(
311 name: *const c_char,
312 base: *mut PyObject,
313 dict: *mut PyObject,
314 ) -> *mut PyObject;
315 #[cfg_attr(PyPy, link_name = "PyPyErr_NewExceptionWithDoc")]
316 pub fn PyErr_NewExceptionWithDoc(
317 name: *const c_char,
318 doc: *const c_char,
319 base: *mut PyObject,
320 dict: *mut PyObject,
321 ) -> *mut PyObject;
322 #[cfg_attr(PyPy, link_name = "PyPyErr_WriteUnraisable")]
323 pub fn PyErr_WriteUnraisable(arg1: *mut PyObject);
324 #[cfg_attr(PyPy, link_name = "PyPyErr_CheckSignals")]
325 pub fn PyErr_CheckSignals() -> c_int;
326 #[cfg_attr(PyPy, link_name = "PyPyErr_SetInterrupt")]
327 pub fn PyErr_SetInterrupt();
328 #[cfg(Py_3_10)]
329 #[cfg_attr(PyPy, link_name = "PyPyErr_SetInterruptEx")]
330 pub fn PyErr_SetInterruptEx(signum: c_int);
331 #[cfg_attr(PyPy, link_name = "PyPyErr_SyntaxLocation")]
332 pub fn PyErr_SyntaxLocation(filename: *const c_char, lineno: c_int);
333 #[cfg_attr(PyPy, link_name = "PyPyErr_SyntaxLocationEx")]
334 pub fn PyErr_SyntaxLocationEx(filename: *const c_char, lineno: c_int, col_offset: c_int);
335 #[cfg_attr(PyPy, link_name = "PyPyErr_ProgramText")]
336 pub fn PyErr_ProgramText(filename: *const c_char, lineno: c_int) -> *mut PyObject;
337 #[cfg(not(PyPy))]
338 pub fn PyUnicodeDecodeError_Create(
339 encoding: *const c_char,
340 object: *const c_char,
341 length: Py_ssize_t,
342 start: Py_ssize_t,
343 end: Py_ssize_t,
344 reason: *const c_char,
345 ) -> *mut PyObject;
346 pub fn PyUnicodeEncodeError_GetEncoding(arg1: *mut PyObject) -> *mut PyObject;
347 pub fn PyUnicodeDecodeError_GetEncoding(arg1: *mut PyObject) -> *mut PyObject;
348 pub fn PyUnicodeEncodeError_GetObject(arg1: *mut PyObject) -> *mut PyObject;
349 pub fn PyUnicodeDecodeError_GetObject(arg1: *mut PyObject) -> *mut PyObject;
350 pub fn PyUnicodeTranslateError_GetObject(arg1: *mut PyObject) -> *mut PyObject;
351 pub fn PyUnicodeEncodeError_GetStart(arg1: *mut PyObject, arg2: *mut Py_ssize_t) -> c_int;
352 pub fn PyUnicodeDecodeError_GetStart(arg1: *mut PyObject, arg2: *mut Py_ssize_t) -> c_int;
353 pub fn PyUnicodeTranslateError_GetStart(arg1: *mut PyObject, arg2: *mut Py_ssize_t) -> c_int;
354 pub fn PyUnicodeEncodeError_SetStart(arg1: *mut PyObject, arg2: Py_ssize_t) -> c_int;
355 pub fn PyUnicodeDecodeError_SetStart(arg1: *mut PyObject, arg2: Py_ssize_t) -> c_int;
356 pub fn PyUnicodeTranslateError_SetStart(arg1: *mut PyObject, arg2: Py_ssize_t) -> c_int;
357 pub fn PyUnicodeEncodeError_GetEnd(arg1: *mut PyObject, arg2: *mut Py_ssize_t) -> c_int;
358 pub fn PyUnicodeDecodeError_GetEnd(arg1: *mut PyObject, arg2: *mut Py_ssize_t) -> c_int;
359 pub fn PyUnicodeTranslateError_GetEnd(arg1: *mut PyObject, arg2: *mut Py_ssize_t) -> c_int;
360 pub fn PyUnicodeEncodeError_SetEnd(arg1: *mut PyObject, arg2: Py_ssize_t) -> c_int;
361 pub fn PyUnicodeDecodeError_SetEnd(arg1: *mut PyObject, arg2: Py_ssize_t) -> c_int;
362 pub fn PyUnicodeTranslateError_SetEnd(arg1: *mut PyObject, arg2: Py_ssize_t) -> c_int;
363 pub fn PyUnicodeEncodeError_GetReason(arg1: *mut PyObject) -> *mut PyObject;
364 pub fn PyUnicodeDecodeError_GetReason(arg1: *mut PyObject) -> *mut PyObject;
365 pub fn PyUnicodeTranslateError_GetReason(arg1: *mut PyObject) -> *mut PyObject;
366 pub fn PyUnicodeEncodeError_SetReason(exc: *mut PyObject, reason: *const c_char) -> c_int;
367 pub fn PyUnicodeDecodeError_SetReason(exc: *mut PyObject, reason: *const c_char) -> c_int;
368 pub fn PyUnicodeTranslateError_SetReason(exc: *mut PyObject, reason: *const c_char) -> c_int;
369}