@@ -428,13 +428,15 @@ pub enum SlotFunc {
428428 SeqConcat ( SeqConcatFunc ) ,
429429 SeqRepeat ( SeqRepeatFunc ) ,
430430 SeqItem ( SeqItemFunc ) ,
431- SeqAssItem ( SeqAssItemFunc ) ,
431+ SeqSetItem ( SeqAssItemFunc ) , // __setitem__ (same func type, value = Some)
432+ SeqDelItem ( SeqAssItemFunc ) , // __delitem__ (same func type, value = None)
432433 SeqContains ( SeqContainsFunc ) ,
433434
434435 // Mapping sub-slots (mp_*)
435436 MapLength ( MapLenFunc ) ,
436437 MapSubscript ( MapSubscriptFunc ) ,
437- MapAssSubscript ( MapAssSubscriptFunc ) ,
438+ MapSetSubscript ( MapAssSubscriptFunc ) , // __setitem__ (same func type, value = Some)
439+ MapDelSubscript ( MapAssSubscriptFunc ) , // __delitem__ (same func type, value = None)
438440
439441 // Number sub-slots (nb_*) - grouped by signature
440442 NumBoolean ( PyNumberUnaryFunc < bool > ) , // __bool__
@@ -468,12 +470,14 @@ impl core::fmt::Debug for SlotFunc {
468470 SlotFunc :: SeqConcat ( _) => write ! ( f, "SlotFunc::SeqConcat(...)" ) ,
469471 SlotFunc :: SeqRepeat ( _) => write ! ( f, "SlotFunc::SeqRepeat(...)" ) ,
470472 SlotFunc :: SeqItem ( _) => write ! ( f, "SlotFunc::SeqItem(...)" ) ,
471- SlotFunc :: SeqAssItem ( _) => write ! ( f, "SlotFunc::SeqAssItem(...)" ) ,
473+ SlotFunc :: SeqSetItem ( _) => write ! ( f, "SlotFunc::SeqSetItem(...)" ) ,
474+ SlotFunc :: SeqDelItem ( _) => write ! ( f, "SlotFunc::SeqDelItem(...)" ) ,
472475 SlotFunc :: SeqContains ( _) => write ! ( f, "SlotFunc::SeqContains(...)" ) ,
473476 // Mapping sub-slots
474477 SlotFunc :: MapLength ( _) => write ! ( f, "SlotFunc::MapLength(...)" ) ,
475478 SlotFunc :: MapSubscript ( _) => write ! ( f, "SlotFunc::MapSubscript(...)" ) ,
476- SlotFunc :: MapAssSubscript ( _) => write ! ( f, "SlotFunc::MapAssSubscript(...)" ) ,
479+ SlotFunc :: MapSetSubscript ( _) => write ! ( f, "SlotFunc::MapSetSubscript(...)" ) ,
480+ SlotFunc :: MapDelSubscript ( _) => write ! ( f, "SlotFunc::MapDelSubscript(...)" ) ,
477481 // Number sub-slots
478482 SlotFunc :: NumBoolean ( _) => write ! ( f, "SlotFunc::NumBoolean(...)" ) ,
479483 SlotFunc :: NumUnary ( _) => write ! ( f, "SlotFunc::NumUnary(...)" ) ,
@@ -600,10 +604,14 @@ impl SlotFunc {
600604 let ( index, ) : ( isize , ) = args. bind ( vm) ?;
601605 func ( obj. sequence_unchecked ( ) , index, vm)
602606 }
603- SlotFunc :: SeqAssItem ( func) => {
604- let ( index, value) : ( isize , crate :: function:: OptionalArg < PyObjectRef > ) =
605- args. bind ( vm) ?;
606- func ( obj. sequence_unchecked ( ) , index, value. into_option ( ) , vm) ?;
607+ SlotFunc :: SeqSetItem ( func) => {
608+ let ( index, value) : ( isize , PyObjectRef ) = args. bind ( vm) ?;
609+ func ( obj. sequence_unchecked ( ) , index, Some ( value) , vm) ?;
610+ Ok ( vm. ctx . none ( ) )
611+ }
612+ SlotFunc :: SeqDelItem ( func) => {
613+ let ( index, ) : ( isize , ) = args. bind ( vm) ?;
614+ func ( obj. sequence_unchecked ( ) , index, None , vm) ?;
607615 Ok ( vm. ctx . none ( ) )
608616 }
609617 SlotFunc :: SeqContains ( func) => {
@@ -621,10 +629,14 @@ impl SlotFunc {
621629 let ( key, ) : ( PyObjectRef , ) = args. bind ( vm) ?;
622630 func ( obj. mapping_unchecked ( ) , & key, vm)
623631 }
624- SlotFunc :: MapAssSubscript ( func) => {
625- let ( key, value) : ( PyObjectRef , crate :: function:: OptionalArg < PyObjectRef > ) =
626- args. bind ( vm) ?;
627- func ( obj. mapping_unchecked ( ) , & key, value. into_option ( ) , vm) ?;
632+ SlotFunc :: MapSetSubscript ( func) => {
633+ let ( key, value) : ( PyObjectRef , PyObjectRef ) = args. bind ( vm) ?;
634+ func ( obj. mapping_unchecked ( ) , & key, Some ( value) , vm) ?;
635+ Ok ( vm. ctx . none ( ) )
636+ }
637+ SlotFunc :: MapDelSubscript ( func) => {
638+ let ( key, ) : ( PyObjectRef , ) = args. bind ( vm) ?;
639+ func ( obj. mapping_unchecked ( ) , & key, None , vm) ?;
628640 Ok ( vm. ctx . none ( ) )
629641 }
630642 // Number sub-slots
0 commit comments