@@ -4,7 +4,7 @@ use crate::{
44 function:: PyArithmeticValue ,
55 object:: { Traverse , TraverseFn } ,
66 protocol:: { PyMapping , PyNumberBinaryOp } ,
7- AsObject , PyObject , PyObjectRef , PyPayload , PyResult , VirtualMachine ,
7+ PyObject , PyObjectRef , PyPayload , PyResult , VirtualMachine ,
88} ;
99use crossbeam_utils:: atomic:: AtomicCell ;
1010use itertools:: Itertools ;
@@ -15,11 +15,11 @@ use std::fmt::Debug;
1515
1616impl PyObject {
1717 #[ inline]
18- pub fn to_sequence ( & self , vm : & VirtualMachine ) -> PySequence < ' _ > {
18+ pub fn to_sequence ( & self ) -> PySequence < ' _ > {
1919 static GLOBAL_NOT_IMPLEMENTED : PySequenceMethods = PySequenceMethods :: NOT_IMPLEMENTED ;
2020 PySequence {
2121 obj : self ,
22- methods : PySequence :: find_methods ( self , vm )
22+ methods : PySequence :: find_methods ( self )
2323 . map_or ( & GLOBAL_NOT_IMPLEMENTED , |x| unsafe { x. borrow_static ( ) } ) ,
2424 }
2525 }
@@ -79,7 +79,7 @@ impl<'a> PySequence<'a> {
7979 }
8080
8181 pub fn try_protocol ( obj : & ' a PyObject , vm : & VirtualMachine ) -> PyResult < Self > {
82- let seq = obj. to_sequence ( vm ) ;
82+ let seq = obj. to_sequence ( ) ;
8383 if seq. check ( ) {
8484 Ok ( seq)
8585 } else {
@@ -93,15 +93,8 @@ impl PySequence<'_> {
9393 self . methods . item . load ( ) . is_some ( )
9494 }
9595
96- pub fn find_methods (
97- obj : & PyObject ,
98- vm : & VirtualMachine ,
99- ) -> Option < PointerSlot < PySequenceMethods > > {
96+ pub fn find_methods ( obj : & PyObject ) -> Option < PointerSlot < PySequenceMethods > > {
10097 let cls = obj. class ( ) ;
101- // if cls.fast_issubclass(vm.ctx.types.dict_type) {
102- if cls. is ( vm. ctx . types . dict_type ) {
103- return None ;
104- }
10598 cls. mro_find_map ( |x| x. slots . as_sequence . load ( ) )
10699 }
107100
@@ -124,7 +117,7 @@ impl PySequence<'_> {
124117 }
125118
126119 // if both arguments apear to be sequences, try fallback to __add__
127- if self . check ( ) && other. to_sequence ( vm ) . check ( ) {
120+ if self . check ( ) && other. to_sequence ( ) . check ( ) {
128121 let ret = vm. binary_op1 ( self . obj , other, PyNumberBinaryOp :: Add ) ?;
129122 if let PyArithmeticValue :: Implemented ( ret) = PyArithmeticValue :: from_object ( vm, ret) {
130123 return Ok ( ret) ;
@@ -162,7 +155,7 @@ impl PySequence<'_> {
162155 }
163156
164157 // if both arguments apear to be sequences, try fallback to __iadd__
165- if self . check ( ) && other. to_sequence ( vm ) . check ( ) {
158+ if self . check ( ) && other. to_sequence ( ) . check ( ) {
166159 let ret = vm. _iadd ( self . obj , other) ?;
167160 if let PyArithmeticValue :: Implemented ( ret) = PyArithmeticValue :: from_object ( vm, ret) {
168161 return Ok ( ret) ;
0 commit comments