@@ -23,8 +23,8 @@ use crate::slots::{Comparable, Hashable, Iterable, PyComparisonOp, PyIter, Unhas
2323use crate :: utils:: Either ;
2424use crate :: vm:: { ReprGuard , VirtualMachine } ;
2525use crate :: {
26- PyClassImpl , PyComparisonValue , PyContext , PyIterable , PyObjectRef , PyRef , PyResult , PyValue ,
27- TryFromObject , TypeProtocol ,
26+ PyClassDef , PyClassImpl , PyComparisonValue , PyContext , PyIterable , PyObjectRef , PyRef ,
27+ PyResult , PyValue , TryFromObject , TypeProtocol ,
2828} ;
2929
3030/// Built-in mutable sequence.
@@ -172,7 +172,7 @@ impl PyList {
172172
173173 #[ pymethod( name = "__getitem__" ) ]
174174 fn getitem ( zelf : PyRef < Self > , needle : PyObjectRef , vm : & VirtualMachine ) -> PyResult {
175- let result = match zelf. borrow_vec ( ) . get_item ( vm, needle, "list" ) ? {
175+ let result = match zelf. borrow_vec ( ) . get_item ( vm, needle, Self :: NAME ) ? {
176176 Either :: A ( obj) => obj,
177177 Either :: B ( vec) => vm. ctx . new_list ( vec) ,
178178 } ;
@@ -182,11 +182,11 @@ impl PyList {
182182 #[ pymethod( name = "__setitem__" ) ]
183183 fn setitem (
184184 & self ,
185- subscript : SequenceIndex ,
185+ needle : PyObjectRef ,
186186 value : PyObjectRef ,
187187 vm : & VirtualMachine ,
188188 ) -> PyResult < ( ) > {
189- match subscript {
189+ match SequenceIndex :: try_from_object_for ( vm , needle , Self :: NAME ) ? {
190190 SequenceIndex :: Int ( index) => self . setindex ( index, value, vm) ,
191191 SequenceIndex :: Slice ( slice) => {
192192 if let Ok ( sec) = PyIterable :: try_from_object ( vm, value) {
0 commit comments