File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -140,7 +140,6 @@ pub trait PyClassImpl: PyClassDef {
140
140
doc : Self :: DOC ,
141
141
..Default :: default ( )
142
142
} ;
143
- // TODO: fill slots by types' PyNumberMethods table
144
143
Self :: extend_slots ( & mut slots) ;
145
144
slots
146
145
}
Original file line number Diff line number Diff line change @@ -319,7 +319,7 @@ fn binary_op_wrapper_right(
319
319
)
320
320
}
321
321
322
- pub fn binary_op_number_left (
322
+ fn binary_op_number_left (
323
323
num : PyNumber ,
324
324
other : & PyObject ,
325
325
op : PyNumberBinaryInfixOp ,
@@ -1406,6 +1406,14 @@ pub trait AsNumber: PyPayload {
1406
1406
fn number_downcast ( num : PyNumber ) -> & Py < Self > {
1407
1407
unsafe { num. obj . downcast_unchecked_ref ( ) }
1408
1408
}
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
+ }
1409
1417
}
1410
1418
1411
1419
#[ pyclass]
You can’t perform that action at this time.
0 commit comments