File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -140,7 +140,6 @@ pub trait PyClassImpl: PyClassDef {
140140 doc : Self :: DOC ,
141141 ..Default :: default ( )
142142 } ;
143- // TODO: fill slots by types' PyNumberMethods table
144143 Self :: extend_slots ( & mut slots) ;
145144 slots
146145 }
Original file line number Diff line number Diff line change @@ -319,7 +319,7 @@ fn binary_op_wrapper_right(
319319 )
320320}
321321
322- pub fn binary_op_number_left (
322+ fn binary_op_number_left (
323323 num : PyNumber ,
324324 other : & PyObject ,
325325 op : PyNumberBinaryInfixOp ,
@@ -1406,6 +1406,14 @@ pub trait AsNumber: PyPayload {
14061406 fn number_downcast ( num : PyNumber ) -> & Py < Self > {
14071407 unsafe { num. obj . downcast_unchecked_ref ( ) }
14081408 }
1409+
1410+ fn extend_slots ( slots : & mut PyTypeSlots ) {
1411+ let methods = Self :: as_number ( ) ;
1412+ if methods. add . load ( ) . is_some ( ) {
1413+ slots. number . add . store ( Some ( binary_op_number_left) ) ;
1414+ slots. number . radd . store ( Some ( binary_op_number_right) ) ;
1415+ }
1416+ }
14091417}
14101418
14111419#[ pyclass]
You can’t perform that action at this time.
0 commit comments