@@ -950,8 +950,9 @@ where
950950pub trait Initializer : PyPayload {
951951 type Args : FromArgs ;
952952
953- #[ pyslot]
954953 #[ inline]
954+ #[ pyslot]
955+ #[ pymethod( name = "__init__" ) ]
955956 fn slot_init ( zelf : PyObjectRef , args : FuncArgs , vm : & VirtualMachine ) -> PyResult < ( ) > {
956957 #[ cfg( debug_assertions) ]
957958 let class_name_for_debug = zelf. class ( ) . name ( ) . to_string ( ) ;
@@ -979,13 +980,6 @@ pub trait Initializer: PyPayload {
979980 Self :: init ( zelf, args, vm)
980981 }
981982
982- #[ pymethod]
983- #[ inline]
984- fn __init__ ( zelf : PyRef < Self > , args : Self :: Args , vm : & VirtualMachine ) -> PyResult < ( ) > {
985- // TODO: check if this is safe. zelf may need to be `PyObjectRef`
986- Self :: init ( zelf, args, vm)
987- }
988-
989983 fn init ( zelf : PyRef < Self > , args : Self :: Args , vm : & VirtualMachine ) -> PyResult < ( ) > ;
990984}
991985
@@ -1340,8 +1334,8 @@ pub trait GetAttr: PyPayload {
13401334
13411335 #[ inline]
13421336 #[ pymethod]
1343- fn __getattribute__ ( zelf : PyRef < Self > , name : PyStrRef , vm : & VirtualMachine ) -> PyResult {
1344- Self :: getattro ( & zelf, & name, vm)
1337+ fn __getattribute__ ( zelf : PyObjectRef , name : PyStrRef , vm : & VirtualMachine ) -> PyResult {
1338+ Self :: slot_getattro ( & zelf, & name, vm)
13451339 }
13461340}
13471341
@@ -1371,18 +1365,18 @@ pub trait SetAttr: PyPayload {
13711365 #[ inline]
13721366 #[ pymethod]
13731367 fn __setattr__ (
1374- zelf : PyRef < Self > ,
1368+ zelf : PyObjectRef ,
13751369 name : PyStrRef ,
13761370 value : PyObjectRef ,
13771371 vm : & VirtualMachine ,
13781372 ) -> PyResult < ( ) > {
1379- Self :: setattro ( & zelf, & name, PySetterValue :: Assign ( value) , vm)
1373+ Self :: slot_setattro ( & zelf, & name, PySetterValue :: Assign ( value) , vm)
13801374 }
13811375
13821376 #[ inline]
13831377 #[ pymethod]
1384- fn __delattr__ ( zelf : PyRef < Self > , name : PyStrRef , vm : & VirtualMachine ) -> PyResult < ( ) > {
1385- Self :: setattro ( & zelf, & name, PySetterValue :: Delete , vm)
1378+ fn __delattr__ ( zelf : PyObjectRef , name : PyStrRef , vm : & VirtualMachine ) -> PyResult < ( ) > {
1379+ Self :: slot_setattro ( & zelf, & name, PySetterValue :: Delete , vm)
13861380 }
13871381}
13881382
0 commit comments