@@ -352,6 +352,115 @@ impl From<&PyNumberMethods> for PyNumberSlots {
352352}
353353
354354impl PyNumberSlots {
355+ /// Copy from static PyNumberMethods
356+ pub fn copy_from ( & self , methods : & PyNumberMethods ) {
357+ if let Some ( f) = methods. add {
358+ self . add . store ( Some ( f) ) ;
359+ }
360+ if let Some ( f) = methods. subtract {
361+ self . subtract . store ( Some ( f) ) ;
362+ }
363+ if let Some ( f) = methods. multiply {
364+ self . multiply . store ( Some ( f) ) ;
365+ }
366+ if let Some ( f) = methods. remainder {
367+ self . remainder . store ( Some ( f) ) ;
368+ }
369+ if let Some ( f) = methods. divmod {
370+ self . divmod . store ( Some ( f) ) ;
371+ }
372+ if let Some ( f) = methods. power {
373+ self . power . store ( Some ( f) ) ;
374+ }
375+ if let Some ( f) = methods. negative {
376+ self . negative . store ( Some ( f) ) ;
377+ }
378+ if let Some ( f) = methods. positive {
379+ self . positive . store ( Some ( f) ) ;
380+ }
381+ if let Some ( f) = methods. absolute {
382+ self . absolute . store ( Some ( f) ) ;
383+ }
384+ if let Some ( f) = methods. boolean {
385+ self . boolean . store ( Some ( f) ) ;
386+ }
387+ if let Some ( f) = methods. invert {
388+ self . invert . store ( Some ( f) ) ;
389+ }
390+ if let Some ( f) = methods. lshift {
391+ self . lshift . store ( Some ( f) ) ;
392+ }
393+ if let Some ( f) = methods. rshift {
394+ self . rshift . store ( Some ( f) ) ;
395+ }
396+ if let Some ( f) = methods. and {
397+ self . and . store ( Some ( f) ) ;
398+ }
399+ if let Some ( f) = methods. xor {
400+ self . xor . store ( Some ( f) ) ;
401+ }
402+ if let Some ( f) = methods. or {
403+ self . or . store ( Some ( f) ) ;
404+ }
405+ if let Some ( f) = methods. int {
406+ self . int . store ( Some ( f) ) ;
407+ }
408+ if let Some ( f) = methods. float {
409+ self . float . store ( Some ( f) ) ;
410+ }
411+ if let Some ( f) = methods. inplace_add {
412+ self . inplace_add . store ( Some ( f) ) ;
413+ }
414+ if let Some ( f) = methods. inplace_subtract {
415+ self . inplace_subtract . store ( Some ( f) ) ;
416+ }
417+ if let Some ( f) = methods. inplace_multiply {
418+ self . inplace_multiply . store ( Some ( f) ) ;
419+ }
420+ if let Some ( f) = methods. inplace_remainder {
421+ self . inplace_remainder . store ( Some ( f) ) ;
422+ }
423+ if let Some ( f) = methods. inplace_power {
424+ self . inplace_power . store ( Some ( f) ) ;
425+ }
426+ if let Some ( f) = methods. inplace_lshift {
427+ self . inplace_lshift . store ( Some ( f) ) ;
428+ }
429+ if let Some ( f) = methods. inplace_rshift {
430+ self . inplace_rshift . store ( Some ( f) ) ;
431+ }
432+ if let Some ( f) = methods. inplace_and {
433+ self . inplace_and . store ( Some ( f) ) ;
434+ }
435+ if let Some ( f) = methods. inplace_xor {
436+ self . inplace_xor . store ( Some ( f) ) ;
437+ }
438+ if let Some ( f) = methods. inplace_or {
439+ self . inplace_or . store ( Some ( f) ) ;
440+ }
441+ if let Some ( f) = methods. floor_divide {
442+ self . floor_divide . store ( Some ( f) ) ;
443+ }
444+ if let Some ( f) = methods. true_divide {
445+ self . true_divide . store ( Some ( f) ) ;
446+ }
447+ if let Some ( f) = methods. inplace_floor_divide {
448+ self . inplace_floor_divide . store ( Some ( f) ) ;
449+ }
450+ if let Some ( f) = methods. inplace_true_divide {
451+ self . inplace_true_divide . store ( Some ( f) ) ;
452+ }
453+ if let Some ( f) = methods. index {
454+ self . index . store ( Some ( f) ) ;
455+ }
456+ if let Some ( f) = methods. matrix_multiply {
457+ self . matrix_multiply . store ( Some ( f) ) ;
458+ }
459+ if let Some ( f) = methods. inplace_matrix_multiply {
460+ self . inplace_matrix_multiply . store ( Some ( f) ) ;
461+ }
462+ }
463+
355464 pub fn left_binary_op ( & self , op_slot : PyNumberBinaryOp ) -> Option < PyNumberBinaryFunc > {
356465 use PyNumberBinaryOp :: * ;
357466 match op_slot {
0 commit comments