@@ -759,7 +759,7 @@ ComplexExtendsException(PyExc_BaseException, SystemExit, SystemExit,
759
759
760
760
761
761
static inline PyBaseExceptionGroupObject *
762
- _PyBaseExceptionGroupObject_cast (PyObject * exc )
762
+ _PyBaseExceptionGroup_CAST (PyObject * exc )
763
763
{
764
764
assert (_PyBaseExceptionGroup_Check (exc ));
765
765
return (PyBaseExceptionGroupObject * )exc ;
@@ -865,7 +865,7 @@ BaseExceptionGroup_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
865
865
cls = (PyTypeObject * )PyExc_BaseExceptionGroup ;
866
866
}
867
867
PyBaseExceptionGroupObject * self =
868
- _PyBaseExceptionGroupObject_cast (BaseException_new (cls , args , kwds ));
868
+ _PyBaseExceptionGroup_CAST (BaseException_new (cls , args , kwds ));
869
869
if (!self ) {
870
870
goto error ;
871
871
}
@@ -896,46 +896,47 @@ _PyExc_CreateExceptionGroup(const char *msg_str, PyObject *excs)
896
896
}
897
897
898
898
static int
899
- BaseExceptionGroup_init (PyBaseExceptionGroupObject * self ,
900
- PyObject * args , PyObject * kwds )
899
+ BaseExceptionGroup_init (PyObject * self , PyObject * args , PyObject * kwds )
901
900
{
902
901
if (!_PyArg_NoKeywords (Py_TYPE (self )-> tp_name , kwds )) {
903
902
return -1 ;
904
903
}
905
- if (BaseException_init (( PyBaseExceptionObject * ) self , args , kwds ) == -1 ) {
904
+ if (BaseException_init (self , args , kwds ) == -1 ) {
906
905
return -1 ;
907
906
}
908
907
return 0 ;
909
908
}
910
909
911
910
static int
912
- BaseExceptionGroup_clear (PyBaseExceptionGroupObject * self )
911
+ BaseExceptionGroup_clear (PyObject * op )
913
912
{
913
+ PyBaseExceptionGroupObject * self = _PyBaseExceptionGroup_CAST (op );
914
914
Py_CLEAR (self -> msg );
915
915
Py_CLEAR (self -> excs );
916
- return BaseException_clear (( PyBaseExceptionObject * ) self );
916
+ return BaseException_clear (op );
917
917
}
918
918
919
919
static void
920
- BaseExceptionGroup_dealloc (PyBaseExceptionGroupObject * self )
920
+ BaseExceptionGroup_dealloc (PyObject * self )
921
921
{
922
922
_PyObject_GC_UNTRACK (self );
923
- BaseExceptionGroup_clear (self );
924
- Py_TYPE (self )-> tp_free (( PyObject * ) self );
923
+ ( void ) BaseExceptionGroup_clear (self );
924
+ Py_TYPE (self )-> tp_free (self );
925
925
}
926
926
927
927
static int
928
- BaseExceptionGroup_traverse (PyBaseExceptionGroupObject * self ,
929
- visitproc visit , void * arg )
928
+ BaseExceptionGroup_traverse (PyObject * op , visitproc visit , void * arg )
930
929
{
930
+ PyBaseExceptionGroupObject * self = _PyBaseExceptionGroup_CAST (op );
931
931
Py_VISIT (self -> msg );
932
932
Py_VISIT (self -> excs );
933
- return BaseException_traverse (( PyBaseExceptionObject * ) self , visit , arg );
933
+ return BaseException_traverse (op , visit , arg );
934
934
}
935
935
936
936
static PyObject *
937
- BaseExceptionGroup_str (PyBaseExceptionGroupObject * self )
937
+ BaseExceptionGroup_str (PyObject * op )
938
938
{
939
+ PyBaseExceptionGroupObject * self = _PyBaseExceptionGroup_CAST (op );
939
940
assert (self -> msg );
940
941
assert (PyUnicode_Check (self -> msg ));
941
942
@@ -949,7 +950,7 @@ BaseExceptionGroup_str(PyBaseExceptionGroupObject *self)
949
950
static PyObject *
950
951
BaseExceptionGroup_derive (PyObject * self_ , PyObject * excs )
951
952
{
952
- PyBaseExceptionGroupObject * self = _PyBaseExceptionGroupObject_cast (self_ );
953
+ PyBaseExceptionGroupObject * self = _PyBaseExceptionGroup_CAST (self_ );
953
954
PyObject * init_args = PyTuple_Pack (2 , self -> msg , excs );
954
955
if (!init_args ) {
955
956
return NULL ;
@@ -1162,7 +1163,7 @@ exceptiongroup_split_recursive(PyObject *exc,
1162
1163
1163
1164
/* Partial match */
1164
1165
1165
- PyBaseExceptionGroupObject * eg = _PyBaseExceptionGroupObject_cast (exc );
1166
+ PyBaseExceptionGroupObject * eg = _PyBaseExceptionGroup_CAST (exc );
1166
1167
assert (PyTuple_CheckExact (eg -> excs ));
1167
1168
Py_ssize_t num_excs = PyTuple_Size (eg -> excs );
1168
1169
if (num_excs < 0 ) {
@@ -1313,7 +1314,7 @@ collect_exception_group_leaf_ids(PyObject *exc, PyObject *leaf_ids)
1313
1314
Py_DECREF (exc_id );
1314
1315
return res ;
1315
1316
}
1316
- PyBaseExceptionGroupObject * eg = _PyBaseExceptionGroupObject_cast (exc );
1317
+ PyBaseExceptionGroupObject * eg = _PyBaseExceptionGroup_CAST (exc );
1317
1318
Py_ssize_t num_excs = PyTuple_GET_SIZE (eg -> excs );
1318
1319
/* recursive calls */
1319
1320
for (Py_ssize_t i = 0 ; i < num_excs ; i ++ ) {
@@ -1545,9 +1546,9 @@ static PyMemberDef BaseExceptionGroup_members[] = {
1545
1546
static PyMethodDef BaseExceptionGroup_methods [] = {
1546
1547
{"__class_getitem__" , (PyCFunction )Py_GenericAlias ,
1547
1548
METH_O |METH_CLASS , PyDoc_STR ("See PEP 585" )},
1548
- {"derive" , ( PyCFunction ) BaseExceptionGroup_derive , METH_O },
1549
- {"split" , ( PyCFunction ) BaseExceptionGroup_split , METH_O },
1550
- {"subgroup" , ( PyCFunction ) BaseExceptionGroup_subgroup , METH_O },
1549
+ {"derive" , BaseExceptionGroup_derive , METH_O },
1550
+ {"split" , BaseExceptionGroup_split , METH_O },
1551
+ {"subgroup" , BaseExceptionGroup_subgroup , METH_O },
1551
1552
{NULL }
1552
1553
};
1553
1554
0 commit comments