File tree 1 file changed +3
-4
lines changed
1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -337,8 +337,8 @@ impl PyRange {
337
337
}
338
338
339
339
#[ pymethod( magic) ]
340
- fn getitem ( & self , subscript : RangeIndex , vm : & VirtualMachine ) -> PyResult {
341
- match subscript {
340
+ fn getitem ( & self , subscript : PyObjectRef , vm : & VirtualMachine ) -> PyResult {
341
+ match RangeIndex :: try_from_object ( vm , subscript) ? {
342
342
RangeIndex :: Slice ( slice) => {
343
343
let ( mut substart, mut substop, mut substep) =
344
344
slice. inner_indices ( & self . compute_length ( ) , vm) ?;
@@ -394,8 +394,7 @@ impl AsMapping for PyRange {
394
394
395
395
#[ inline]
396
396
fn subscript ( zelf : PyObjectRef , needle : PyObjectRef , vm : & VirtualMachine ) -> PyResult {
397
- Self :: downcast_ref ( & zelf, vm)
398
- . map ( |zelf| zelf. getitem ( RangeIndex :: try_from_object ( vm, needle) ?, vm) ) ?
397
+ Self :: downcast_ref ( & zelf, vm) . map ( |zelf| zelf. getitem ( needle, vm) ) ?
399
398
}
400
399
401
400
#[ inline]
You can’t perform that action at this time.
0 commit comments