20
20
21
21
/*[clinic input]
22
22
class BaseException "PyBaseExceptionObject *" "&PyExc_BaseException"
23
+ class BaseExceptionGroup "PyBaseExceptionGroupObject *" "&PyExc_BaseExceptionGroup"
23
24
[clinic start generated code]*/
24
- /*[clinic end generated code: output=da39a3ee5e6b4b0d input=90558eb0fbf8a3d0 ]*/
25
+ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=b7c45e78cff8edc3 ]*/
25
26
26
27
27
28
/* Compatibility aliases */
@@ -1034,10 +1035,18 @@ BaseExceptionGroup_str(PyBaseExceptionGroupObject *self)
1034
1035
self -> msg , num_excs , num_excs > 1 ? "s" : "" );
1035
1036
}
1036
1037
1038
+ /*[clinic input]
1039
+ @critical_section
1040
+ BaseExceptionGroup.derive
1041
+ excs: object
1042
+ /
1043
+ [clinic start generated code]*/
1044
+
1037
1045
static PyObject *
1038
- BaseExceptionGroup_derive (PyObject * self_ , PyObject * excs )
1046
+ BaseExceptionGroup_derive_impl (PyBaseExceptionGroupObject * self ,
1047
+ PyObject * excs )
1048
+ /*[clinic end generated code: output=4307564218dfbf06 input=f72009d38e98cec1]*/
1039
1049
{
1040
- PyBaseExceptionGroupObject * self = _PyBaseExceptionGroupObject_cast (self_ );
1041
1050
PyObject * init_args = PyTuple_Pack (2 , self -> msg , excs );
1042
1051
if (!init_args ) {
1043
1052
return NULL ;
@@ -1330,8 +1339,17 @@ exceptiongroup_split_recursive(PyObject *exc,
1330
1339
return retval ;
1331
1340
}
1332
1341
1342
+ /*[clinic input]
1343
+ @critical_section
1344
+ BaseExceptionGroup.split
1345
+ matcher_value: object
1346
+ /
1347
+ [clinic start generated code]*/
1348
+
1333
1349
static PyObject *
1334
- BaseExceptionGroup_split (PyObject * self , PyObject * matcher_value )
1350
+ BaseExceptionGroup_split_impl (PyBaseExceptionGroupObject * self ,
1351
+ PyObject * matcher_value )
1352
+ /*[clinic end generated code: output=d74db579da4df6e2 input=0c5cfbfed57e0052]*/
1335
1353
{
1336
1354
_exceptiongroup_split_matcher_type matcher_type ;
1337
1355
if (get_matcher_type (matcher_value , & matcher_type ) < 0 ) {
@@ -1341,7 +1359,7 @@ BaseExceptionGroup_split(PyObject *self, PyObject *matcher_value)
1341
1359
_exceptiongroup_split_result split_result ;
1342
1360
bool construct_rest = true;
1343
1361
if (exceptiongroup_split_recursive (
1344
- self , matcher_type , matcher_value ,
1362
+ ( PyObject * ) self , matcher_type , matcher_value ,
1345
1363
construct_rest , & split_result ) < 0 ) {
1346
1364
return NULL ;
1347
1365
}
@@ -1356,8 +1374,17 @@ BaseExceptionGroup_split(PyObject *self, PyObject *matcher_value)
1356
1374
return result ;
1357
1375
}
1358
1376
1377
+ /*[clinic input]
1378
+ @critical_section
1379
+ BaseExceptionGroup.subgroup
1380
+ matcher_value: object
1381
+ /
1382
+ [clinic start generated code]*/
1383
+
1359
1384
static PyObject *
1360
- BaseExceptionGroup_subgroup (PyObject * self , PyObject * matcher_value )
1385
+ BaseExceptionGroup_subgroup_impl (PyBaseExceptionGroupObject * self ,
1386
+ PyObject * matcher_value )
1387
+ /*[clinic end generated code: output=07dbec8f77d4dd8e input=988ffdd755a151ce]*/
1361
1388
{
1362
1389
_exceptiongroup_split_matcher_type matcher_type ;
1363
1390
if (get_matcher_type (matcher_value , & matcher_type ) < 0 ) {
@@ -1367,7 +1394,7 @@ BaseExceptionGroup_subgroup(PyObject *self, PyObject *matcher_value)
1367
1394
_exceptiongroup_split_result split_result ;
1368
1395
bool construct_rest = false;
1369
1396
if (exceptiongroup_split_recursive (
1370
- self , matcher_type , matcher_value ,
1397
+ ( PyObject * ) self , matcher_type , matcher_value ,
1371
1398
construct_rest , & split_result ) < 0 ) {
1372
1399
return NULL ;
1373
1400
}
@@ -1633,9 +1660,9 @@ static PyMemberDef BaseExceptionGroup_members[] = {
1633
1660
static PyMethodDef BaseExceptionGroup_methods [] = {
1634
1661
{"__class_getitem__" , (PyCFunction )Py_GenericAlias ,
1635
1662
METH_O |METH_CLASS , PyDoc_STR ("See PEP 585" )},
1636
- { "derive" , ( PyCFunction ) BaseExceptionGroup_derive , METH_O },
1637
- { "split" , ( PyCFunction ) BaseExceptionGroup_split , METH_O },
1638
- { "subgroup" , ( PyCFunction ) BaseExceptionGroup_subgroup , METH_O },
1663
+ BASEEXCEPTIONGROUP_DERIVE_METHODDEF
1664
+ BASEEXCEPTIONGROUP_SPLIT_METHODDEF
1665
+ BASEEXCEPTIONGROUP_SUBGROUP_METHODDEF
1639
1666
{NULL }
1640
1667
};
1641
1668
0 commit comments