Coverage Report

Created: 2025-07-04 06:49

/src/cpython/Objects/clinic/exceptions.c.h
Line
Count
Source (jump to first uncovered line)
1
/*[clinic input]
2
preserve
3
[clinic start generated code]*/
4
5
#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
6
#include "pycore_modsupport.h"    // _PyArg_BadArgument()
7
8
PyDoc_STRVAR(BaseException___reduce____doc__,
9
"__reduce__($self, /)\n"
10
"--\n"
11
"\n");
12
13
#define BASEEXCEPTION___REDUCE___METHODDEF    \
14
    {"__reduce__", (PyCFunction)BaseException___reduce__, METH_NOARGS, BaseException___reduce____doc__},
15
16
static PyObject *
17
BaseException___reduce___impl(PyBaseExceptionObject *self);
18
19
static PyObject *
20
BaseException___reduce__(PyObject *self, PyObject *Py_UNUSED(ignored))
21
0
{
22
0
    PyObject *return_value = NULL;
23
24
0
    Py_BEGIN_CRITICAL_SECTION(self);
25
0
    return_value = BaseException___reduce___impl((PyBaseExceptionObject *)self);
26
0
    Py_END_CRITICAL_SECTION();
27
28
0
    return return_value;
29
0
}
30
31
PyDoc_STRVAR(BaseException___setstate____doc__,
32
"__setstate__($self, state, /)\n"
33
"--\n"
34
"\n");
35
36
#define BASEEXCEPTION___SETSTATE___METHODDEF    \
37
    {"__setstate__", (PyCFunction)BaseException___setstate__, METH_O, BaseException___setstate____doc__},
38
39
static PyObject *
40
BaseException___setstate___impl(PyBaseExceptionObject *self, PyObject *state);
41
42
static PyObject *
43
BaseException___setstate__(PyObject *self, PyObject *state)
44
0
{
45
0
    PyObject *return_value = NULL;
46
47
0
    Py_BEGIN_CRITICAL_SECTION(self);
48
0
    return_value = BaseException___setstate___impl((PyBaseExceptionObject *)self, state);
49
0
    Py_END_CRITICAL_SECTION();
50
51
0
    return return_value;
52
0
}
53
54
PyDoc_STRVAR(BaseException_with_traceback__doc__,
55
"with_traceback($self, tb, /)\n"
56
"--\n"
57
"\n"
58
"Set self.__traceback__ to tb and return self.");
59
60
#define BASEEXCEPTION_WITH_TRACEBACK_METHODDEF    \
61
    {"with_traceback", (PyCFunction)BaseException_with_traceback, METH_O, BaseException_with_traceback__doc__},
62
63
static PyObject *
64
BaseException_with_traceback_impl(PyBaseExceptionObject *self, PyObject *tb);
65
66
static PyObject *
67
BaseException_with_traceback(PyObject *self, PyObject *tb)
68
0
{
69
0
    PyObject *return_value = NULL;
70
71
0
    Py_BEGIN_CRITICAL_SECTION(self);
72
0
    return_value = BaseException_with_traceback_impl((PyBaseExceptionObject *)self, tb);
73
0
    Py_END_CRITICAL_SECTION();
74
75
0
    return return_value;
76
0
}
77
78
PyDoc_STRVAR(BaseException_add_note__doc__,
79
"add_note($self, note, /)\n"
80
"--\n"
81
"\n"
82
"Add a note to the exception");
83
84
#define BASEEXCEPTION_ADD_NOTE_METHODDEF    \
85
    {"add_note", (PyCFunction)BaseException_add_note, METH_O, BaseException_add_note__doc__},
86
87
static PyObject *
88
BaseException_add_note_impl(PyBaseExceptionObject *self, PyObject *note);
89
90
static PyObject *
91
BaseException_add_note(PyObject *self, PyObject *arg)
92
46.2k
{
93
46.2k
    PyObject *return_value = NULL;
94
46.2k
    PyObject *note;
95
96
46.2k
    if (!PyUnicode_Check(arg)) {
97
0
        _PyArg_BadArgument("add_note", "argument", "str", arg);
98
0
        goto exit;
99
0
    }
100
46.2k
    note = arg;
101
46.2k
    Py_BEGIN_CRITICAL_SECTION(self);
102
46.2k
    return_value = BaseException_add_note_impl((PyBaseExceptionObject *)self, note);
103
46.2k
    Py_END_CRITICAL_SECTION();
104
105
46.2k
exit:
106
46.2k
    return return_value;
107
46.2k
}
108
109
#if !defined(BaseException_args_DOCSTR)
110
#  define BaseException_args_DOCSTR NULL
111
#endif
112
#if defined(BASEEXCEPTION_ARGS_GETSETDEF)
113
#  undef BASEEXCEPTION_ARGS_GETSETDEF
114
#  define BASEEXCEPTION_ARGS_GETSETDEF {"args", (getter)BaseException_args_get, (setter)BaseException_args_set, BaseException_args_DOCSTR},
115
#else
116
#  define BASEEXCEPTION_ARGS_GETSETDEF {"args", (getter)BaseException_args_get, NULL, BaseException_args_DOCSTR},
117
#endif
118
119
static PyObject *
120
BaseException_args_get_impl(PyBaseExceptionObject *self);
121
122
static PyObject *
123
BaseException_args_get(PyObject *self, void *Py_UNUSED(context))
124
0
{
125
0
    PyObject *return_value = NULL;
126
127
0
    Py_BEGIN_CRITICAL_SECTION(self);
128
0
    return_value = BaseException_args_get_impl((PyBaseExceptionObject *)self);
129
0
    Py_END_CRITICAL_SECTION();
130
131
0
    return return_value;
132
0
}
133
134
#if !defined(BaseException_args_DOCSTR)
135
#  define BaseException_args_DOCSTR NULL
136
#endif
137
#if defined(BASEEXCEPTION_ARGS_GETSETDEF)
138
#  undef BASEEXCEPTION_ARGS_GETSETDEF
139
#  define BASEEXCEPTION_ARGS_GETSETDEF {"args", (getter)BaseException_args_get, (setter)BaseException_args_set, BaseException_args_DOCSTR},
140
#else
141
#  define BASEEXCEPTION_ARGS_GETSETDEF {"args", NULL, (setter)BaseException_args_set, NULL},
142
#endif
143
144
static int
145
BaseException_args_set_impl(PyBaseExceptionObject *self, PyObject *value);
146
147
static int
148
BaseException_args_set(PyObject *self, PyObject *value, void *Py_UNUSED(context))
149
963
{
150
963
    int return_value;
151
152
963
    Py_BEGIN_CRITICAL_SECTION(self);
153
963
    return_value = BaseException_args_set_impl((PyBaseExceptionObject *)self, value);
154
963
    Py_END_CRITICAL_SECTION();
155
156
963
    return return_value;
157
963
}
158
159
#if !defined(BaseException___traceback___DOCSTR)
160
#  define BaseException___traceback___DOCSTR NULL
161
#endif
162
#if defined(BASEEXCEPTION___TRACEBACK___GETSETDEF)
163
#  undef BASEEXCEPTION___TRACEBACK___GETSETDEF
164
#  define BASEEXCEPTION___TRACEBACK___GETSETDEF {"__traceback__", (getter)BaseException___traceback___get, (setter)BaseException___traceback___set, BaseException___traceback___DOCSTR},
165
#else
166
#  define BASEEXCEPTION___TRACEBACK___GETSETDEF {"__traceback__", (getter)BaseException___traceback___get, NULL, BaseException___traceback___DOCSTR},
167
#endif
168
169
static PyObject *
170
BaseException___traceback___get_impl(PyBaseExceptionObject *self);
171
172
static PyObject *
173
BaseException___traceback___get(PyObject *self, void *Py_UNUSED(context))
174
0
{
175
0
    PyObject *return_value = NULL;
176
177
0
    Py_BEGIN_CRITICAL_SECTION(self);
178
0
    return_value = BaseException___traceback___get_impl((PyBaseExceptionObject *)self);
179
0
    Py_END_CRITICAL_SECTION();
180
181
0
    return return_value;
182
0
}
183
184
#if !defined(BaseException___traceback___DOCSTR)
185
#  define BaseException___traceback___DOCSTR NULL
186
#endif
187
#if defined(BASEEXCEPTION___TRACEBACK___GETSETDEF)
188
#  undef BASEEXCEPTION___TRACEBACK___GETSETDEF
189
#  define BASEEXCEPTION___TRACEBACK___GETSETDEF {"__traceback__", (getter)BaseException___traceback___get, (setter)BaseException___traceback___set, BaseException___traceback___DOCSTR},
190
#else
191
#  define BASEEXCEPTION___TRACEBACK___GETSETDEF {"__traceback__", NULL, (setter)BaseException___traceback___set, NULL},
192
#endif
193
194
static int
195
BaseException___traceback___set_impl(PyBaseExceptionObject *self,
196
                                     PyObject *value);
197
198
static int
199
BaseException___traceback___set(PyObject *self, PyObject *value, void *Py_UNUSED(context))
200
2.92k
{
201
2.92k
    int return_value;
202
203
2.92k
    Py_BEGIN_CRITICAL_SECTION(self);
204
2.92k
    return_value = BaseException___traceback___set_impl((PyBaseExceptionObject *)self, value);
205
2.92k
    Py_END_CRITICAL_SECTION();
206
207
2.92k
    return return_value;
208
2.92k
}
209
210
#if !defined(BaseException___context___DOCSTR)
211
#  define BaseException___context___DOCSTR NULL
212
#endif
213
#if defined(BASEEXCEPTION___CONTEXT___GETSETDEF)
214
#  undef BASEEXCEPTION___CONTEXT___GETSETDEF
215
#  define BASEEXCEPTION___CONTEXT___GETSETDEF {"__context__", (getter)BaseException___context___get, (setter)BaseException___context___set, BaseException___context___DOCSTR},
216
#else
217
#  define BASEEXCEPTION___CONTEXT___GETSETDEF {"__context__", (getter)BaseException___context___get, NULL, BaseException___context___DOCSTR},
218
#endif
219
220
static PyObject *
221
BaseException___context___get_impl(PyBaseExceptionObject *self);
222
223
static PyObject *
224
BaseException___context___get(PyObject *self, void *Py_UNUSED(context))
225
0
{
226
0
    PyObject *return_value = NULL;
227
228
0
    Py_BEGIN_CRITICAL_SECTION(self);
229
0
    return_value = BaseException___context___get_impl((PyBaseExceptionObject *)self);
230
0
    Py_END_CRITICAL_SECTION();
231
232
0
    return return_value;
233
0
}
234
235
#if !defined(BaseException___context___DOCSTR)
236
#  define BaseException___context___DOCSTR NULL
237
#endif
238
#if defined(BASEEXCEPTION___CONTEXT___GETSETDEF)
239
#  undef BASEEXCEPTION___CONTEXT___GETSETDEF
240
#  define BASEEXCEPTION___CONTEXT___GETSETDEF {"__context__", (getter)BaseException___context___get, (setter)BaseException___context___set, BaseException___context___DOCSTR},
241
#else
242
#  define BASEEXCEPTION___CONTEXT___GETSETDEF {"__context__", NULL, (setter)BaseException___context___set, NULL},
243
#endif
244
245
static int
246
BaseException___context___set_impl(PyBaseExceptionObject *self,
247
                                   PyObject *value);
248
249
static int
250
BaseException___context___set(PyObject *self, PyObject *value, void *Py_UNUSED(context))
251
0
{
252
0
    int return_value;
253
254
0
    Py_BEGIN_CRITICAL_SECTION(self);
255
0
    return_value = BaseException___context___set_impl((PyBaseExceptionObject *)self, value);
256
0
    Py_END_CRITICAL_SECTION();
257
258
0
    return return_value;
259
0
}
260
261
#if !defined(BaseException___cause___DOCSTR)
262
#  define BaseException___cause___DOCSTR NULL
263
#endif
264
#if defined(BASEEXCEPTION___CAUSE___GETSETDEF)
265
#  undef BASEEXCEPTION___CAUSE___GETSETDEF
266
#  define BASEEXCEPTION___CAUSE___GETSETDEF {"__cause__", (getter)BaseException___cause___get, (setter)BaseException___cause___set, BaseException___cause___DOCSTR},
267
#else
268
#  define BASEEXCEPTION___CAUSE___GETSETDEF {"__cause__", (getter)BaseException___cause___get, NULL, BaseException___cause___DOCSTR},
269
#endif
270
271
static PyObject *
272
BaseException___cause___get_impl(PyBaseExceptionObject *self);
273
274
static PyObject *
275
BaseException___cause___get(PyObject *self, void *Py_UNUSED(context))
276
0
{
277
0
    PyObject *return_value = NULL;
278
279
0
    Py_BEGIN_CRITICAL_SECTION(self);
280
0
    return_value = BaseException___cause___get_impl((PyBaseExceptionObject *)self);
281
0
    Py_END_CRITICAL_SECTION();
282
283
0
    return return_value;
284
0
}
285
286
#if !defined(BaseException___cause___DOCSTR)
287
#  define BaseException___cause___DOCSTR NULL
288
#endif
289
#if defined(BASEEXCEPTION___CAUSE___GETSETDEF)
290
#  undef BASEEXCEPTION___CAUSE___GETSETDEF
291
#  define BASEEXCEPTION___CAUSE___GETSETDEF {"__cause__", (getter)BaseException___cause___get, (setter)BaseException___cause___set, BaseException___cause___DOCSTR},
292
#else
293
#  define BASEEXCEPTION___CAUSE___GETSETDEF {"__cause__", NULL, (setter)BaseException___cause___set, NULL},
294
#endif
295
296
static int
297
BaseException___cause___set_impl(PyBaseExceptionObject *self,
298
                                 PyObject *value);
299
300
static int
301
BaseException___cause___set(PyObject *self, PyObject *value, void *Py_UNUSED(context))
302
0
{
303
0
    int return_value;
304
305
0
    Py_BEGIN_CRITICAL_SECTION(self);
306
0
    return_value = BaseException___cause___set_impl((PyBaseExceptionObject *)self, value);
307
0
    Py_END_CRITICAL_SECTION();
308
309
0
    return return_value;
310
0
}
311
312
PyDoc_STRVAR(BaseExceptionGroup_derive__doc__,
313
"derive($self, excs, /)\n"
314
"--\n"
315
"\n");
316
317
#define BASEEXCEPTIONGROUP_DERIVE_METHODDEF    \
318
    {"derive", (PyCFunction)BaseExceptionGroup_derive, METH_O, BaseExceptionGroup_derive__doc__},
319
320
static PyObject *
321
BaseExceptionGroup_derive_impl(PyBaseExceptionGroupObject *self,
322
                               PyObject *excs);
323
324
static PyObject *
325
BaseExceptionGroup_derive(PyObject *self, PyObject *excs)
326
0
{
327
0
    PyObject *return_value = NULL;
328
329
0
    Py_BEGIN_CRITICAL_SECTION(self);
330
0
    return_value = BaseExceptionGroup_derive_impl((PyBaseExceptionGroupObject *)self, excs);
331
0
    Py_END_CRITICAL_SECTION();
332
333
0
    return return_value;
334
0
}
335
336
PyDoc_STRVAR(BaseExceptionGroup_split__doc__,
337
"split($self, matcher_value, /)\n"
338
"--\n"
339
"\n");
340
341
#define BASEEXCEPTIONGROUP_SPLIT_METHODDEF    \
342
    {"split", (PyCFunction)BaseExceptionGroup_split, METH_O, BaseExceptionGroup_split__doc__},
343
344
static PyObject *
345
BaseExceptionGroup_split_impl(PyBaseExceptionGroupObject *self,
346
                              PyObject *matcher_value);
347
348
static PyObject *
349
BaseExceptionGroup_split(PyObject *self, PyObject *matcher_value)
350
0
{
351
0
    PyObject *return_value = NULL;
352
353
0
    Py_BEGIN_CRITICAL_SECTION(self);
354
0
    return_value = BaseExceptionGroup_split_impl((PyBaseExceptionGroupObject *)self, matcher_value);
355
0
    Py_END_CRITICAL_SECTION();
356
357
0
    return return_value;
358
0
}
359
360
PyDoc_STRVAR(BaseExceptionGroup_subgroup__doc__,
361
"subgroup($self, matcher_value, /)\n"
362
"--\n"
363
"\n");
364
365
#define BASEEXCEPTIONGROUP_SUBGROUP_METHODDEF    \
366
    {"subgroup", (PyCFunction)BaseExceptionGroup_subgroup, METH_O, BaseExceptionGroup_subgroup__doc__},
367
368
static PyObject *
369
BaseExceptionGroup_subgroup_impl(PyBaseExceptionGroupObject *self,
370
                                 PyObject *matcher_value);
371
372
static PyObject *
373
BaseExceptionGroup_subgroup(PyObject *self, PyObject *matcher_value)
374
0
{
375
0
    PyObject *return_value = NULL;
376
377
0
    Py_BEGIN_CRITICAL_SECTION(self);
378
0
    return_value = BaseExceptionGroup_subgroup_impl((PyBaseExceptionGroupObject *)self, matcher_value);
379
0
    Py_END_CRITICAL_SECTION();
380
381
0
    return return_value;
382
0
}
383
/*[clinic end generated code: output=fcf70b3b71f3d14a input=a9049054013a1b77]*/