1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
use crate::PyObject;
#[cfg(not(PyPy))]
use crate::Py_ssize_t;

#[repr(C)]
#[derive(Debug)]
pub struct PyBaseExceptionObject {
    pub ob_base: PyObject,
    #[cfg(not(PyPy))]
    pub dict: *mut PyObject,
    #[cfg(not(PyPy))]
    pub args: *mut PyObject,
    #[cfg(all(Py_3_11, not(PyPy)))]
    pub notes: *mut PyObject,
    #[cfg(not(PyPy))]
    pub traceback: *mut PyObject,
    #[cfg(not(PyPy))]
    pub context: *mut PyObject,
    #[cfg(not(PyPy))]
    pub cause: *mut PyObject,
    #[cfg(not(PyPy))]
    pub suppress_context: char,
}

#[cfg(not(PyPy))]
#[repr(C)]
#[derive(Debug)]
pub struct PySyntaxErrorObject {
    pub ob_base: PyObject,
    pub dict: *mut PyObject,
    pub args: *mut PyObject,
    #[cfg(Py_3_11)]
    pub notes: *mut PyObject,
    pub traceback: *mut PyObject,
    pub context: *mut PyObject,
    pub cause: *mut PyObject,
    pub suppress_context: char,

    pub msg: *mut PyObject,
    pub filename: *mut PyObject,
    pub lineno: *mut PyObject,
    pub offset: *mut PyObject,
    #[cfg(Py_3_10)]
    pub end_lineno: *mut PyObject,
    #[cfg(Py_3_10)]
    pub end_offset: *mut PyObject,
    pub text: *mut PyObject,
    pub print_file_and_line: *mut PyObject,
}

#[cfg(not(PyPy))]
#[repr(C)]
#[derive(Debug)]
pub struct PyImportErrorObject {
    pub ob_base: PyObject,
    pub dict: *mut PyObject,
    pub args: *mut PyObject,
    #[cfg(Py_3_11)]
    pub notes: *mut PyObject,
    pub traceback: *mut PyObject,
    pub context: *mut PyObject,
    pub cause: *mut PyObject,
    pub suppress_context: char,

    pub msg: *mut PyObject,
    pub name: *mut PyObject,
    pub path: *mut PyObject,
    #[cfg(Py_3_12)]
    pub name_from: *mut PyObject,
}

#[cfg(not(PyPy))]
#[repr(C)]
#[derive(Debug)]
pub struct PyUnicodeErrorObject {
    pub ob_base: PyObject,
    pub dict: *mut PyObject,
    pub args: *mut PyObject,
    #[cfg(Py_3_11)]
    pub notes: *mut PyObject,
    pub traceback: *mut PyObject,
    pub context: *mut PyObject,
    pub cause: *mut PyObject,
    pub suppress_context: char,

    pub encoding: *mut PyObject,
    pub object: *mut PyObject,
    pub start: Py_ssize_t,
    pub end: Py_ssize_t,
    pub reason: *mut PyObject,
}

#[cfg(not(PyPy))]
#[repr(C)]
#[derive(Debug)]
pub struct PySystemExitObject {
    pub ob_base: PyObject,
    pub dict: *mut PyObject,
    pub args: *mut PyObject,
    #[cfg(Py_3_11)]
    pub notes: *mut PyObject,
    pub traceback: *mut PyObject,
    pub context: *mut PyObject,
    pub cause: *mut PyObject,
    pub suppress_context: char,

    pub code: *mut PyObject,
}

#[cfg(not(PyPy))]
#[repr(C)]
#[derive(Debug)]
pub struct PyOSErrorObject {
    pub ob_base: PyObject,
    pub dict: *mut PyObject,
    pub args: *mut PyObject,
    #[cfg(Py_3_11)]
    pub notes: *mut PyObject,
    pub traceback: *mut PyObject,
    pub context: *mut PyObject,
    pub cause: *mut PyObject,
    pub suppress_context: char,

    pub myerrno: *mut PyObject,
    pub strerror: *mut PyObject,
    pub filename: *mut PyObject,
    pub filename2: *mut PyObject,
    #[cfg(windows)]
    pub winerror: *mut PyObject,
    pub written: Py_ssize_t,
}

#[repr(C)]
#[derive(Debug)]
pub struct PyStopIterationObject {
    pub ob_base: PyObject,
    #[cfg(not(PyPy))]
    pub dict: *mut PyObject,
    #[cfg(not(PyPy))]
    pub args: *mut PyObject,
    #[cfg(all(Py_3_11, not(PyPy)))]
    pub notes: *mut PyObject,
    #[cfg(not(PyPy))]
    pub traceback: *mut PyObject,
    #[cfg(not(PyPy))]
    pub context: *mut PyObject,
    #[cfg(not(PyPy))]
    pub cause: *mut PyObject,
    #[cfg(not(PyPy))]
    pub suppress_context: char,

    pub value: *mut PyObject,
}

extern "C" {
    #[cfg(not(PyPy))]
    pub fn _PyErr_ChainExceptions(typ: *mut PyObject, val: *mut PyObject, tb: *mut PyObject);
}

// skipped PyNameErrorObject
// skipped PyAttributeErrorObject

// skipped PyEnvironmentErrorObject
// skipped PyWindowsErrorObject

// skipped _PyErr_SetKeyError
// skipped _PyErr_GetTopmostException
// skipped _PyErr_GetExcInfo

// skipped PyErr_SetFromErrnoWithUnicodeFilename

// skipped _PyErr_FormatFromCause

// skipped PyErr_SetFromWindowsErrWithUnicodeFilename
// skipped PyErr_SetExcFromWindowsErrWithUnicodeFilename

// skipped _PyErr_TrySetFromCause

// skipped PySignal_SetWakeupFd
// skipped _PyErr_CheckSignals

// skipped PyErr_SyntaxLocationObject
// skipped PyErr_RangedSyntaxLocationObject
// skipped PyErr_ProgramTextObject

// skipped _PyErr_ProgramDecodedTextObject
// skipped _PyUnicodeTranslateError_Create
// skipped _PyErr_WriteUnraisableMsg
// skipped _Py_FatalErrorFunc
// skipped _Py_FatalErrorFormat
// skipped Py_FatalError