@@ -691,14 +691,22 @@ SimpleExtendsException(PyExc_BaseException, GeneratorExit,
691
691
* SystemExit extends BaseException
692
692
*/
693
693
694
+ static inline PySystemExitObject *
695
+ _PySystemExit_CAST (PyObject * self )
696
+ {
697
+ assert (PyObject_TypeCheck (self , (PyTypeObject * )PyExc_SystemExit ));
698
+ return (PySystemExitObject * )self ;
699
+ }
700
+
694
701
static int
695
- SystemExit_init (PySystemExitObject * self , PyObject * args , PyObject * kwds )
702
+ SystemExit_init (PyObject * op , PyObject * args , PyObject * kwds )
696
703
{
697
704
Py_ssize_t size = PyTuple_GET_SIZE (args );
698
705
699
- if (BaseException_init (( PyBaseExceptionObject * ) self , args , kwds ) == -1 )
706
+ if (BaseException_init (op , args , kwds ) == -1 )
700
707
return -1 ;
701
708
709
+ PySystemExitObject * self = _PySystemExit_CAST (op );
702
710
if (size == 0 )
703
711
return 0 ;
704
712
if (size == 1 ) {
@@ -711,25 +719,27 @@ SystemExit_init(PySystemExitObject *self, PyObject *args, PyObject *kwds)
711
719
}
712
720
713
721
static int
714
- SystemExit_clear (PySystemExitObject * self )
722
+ SystemExit_clear (PyObject * op )
715
723
{
724
+ PySystemExitObject * self = _PySystemExit_CAST (op );
716
725
Py_CLEAR (self -> code );
717
- return BaseException_clear (( PyBaseExceptionObject * ) self );
726
+ return BaseException_clear (op );
718
727
}
719
728
720
729
static void
721
- SystemExit_dealloc (PySystemExitObject * self )
730
+ SystemExit_dealloc (PyObject * self )
722
731
{
723
732
_PyObject_GC_UNTRACK (self );
724
- SystemExit_clear (self );
725
- Py_TYPE (self )-> tp_free (( PyObject * ) self );
733
+ ( void ) SystemExit_clear (self );
734
+ Py_TYPE (self )-> tp_free (self );
726
735
}
727
736
728
737
static int
729
- SystemExit_traverse (PySystemExitObject * self , visitproc visit , void * arg )
738
+ SystemExit_traverse (PyObject * op , visitproc visit , void * arg )
730
739
{
740
+ PySystemExitObject * self = _PySystemExit_CAST (op );
731
741
Py_VISIT (self -> code );
732
- return BaseException_traverse (( PyBaseExceptionObject * ) self , visit , arg );
742
+ return BaseException_traverse (op , visit , arg );
733
743
}
734
744
735
745
static PyMemberDef SystemExit_members [] = {
0 commit comments