@@ -138,23 +138,21 @@ impl PyList {
138138 self . concat ( & other, vm)
139139 }
140140
141- fn inplace_concat ( zelf : & Py < Self > , other : & PyObject , vm : & VirtualMachine ) -> PyObjectRef {
142- if let Ok ( mut seq) = extract_cloned ( other, Ok , vm) {
143- zelf. borrow_vec_mut ( ) . append ( & mut seq) ;
144- zelf. to_owned ( ) . into ( )
145- } else {
146- vm. ctx . not_implemented ( )
147- }
141+ fn inplace_concat (
142+ zelf : & Py < Self > ,
143+ other : & PyObject ,
144+ vm : & VirtualMachine ,
145+ ) -> PyResult < PyObjectRef > {
146+ let mut seq = extract_cloned ( other, Ok , vm) ?;
147+ zelf. borrow_vec_mut ( ) . append ( & mut seq) ;
148+ Ok ( zelf. to_owned ( ) . into ( ) )
148149 }
149150
150151 #[ pymethod( magic) ]
151- fn iadd ( zelf : PyRef < Self > , other : PyObjectRef , vm : & VirtualMachine ) -> PyObjectRef {
152- if let Ok ( mut seq) = extract_cloned ( & * other, Ok , vm) {
153- zelf. borrow_vec_mut ( ) . append ( & mut seq) ;
154- zelf. into ( )
155- } else {
156- vm. ctx . not_implemented ( )
157- }
152+ fn iadd ( zelf : PyRef < Self > , other : PyObjectRef , vm : & VirtualMachine ) -> PyResult < PyRef < Self > > {
153+ let mut seq = extract_cloned ( & * other, Ok , vm) ?;
154+ zelf. borrow_vec_mut ( ) . append ( & mut seq) ;
155+ Ok ( zelf)
158156 }
159157
160158 #[ pymethod( magic) ]
@@ -462,7 +460,7 @@ impl AsSequence for PyList {
462460 } ) ,
463461 inplace_concat : Some ( |seq, other, vm| {
464462 let zelf = Self :: sequence_downcast ( seq) ;
465- Ok ( Self :: inplace_concat ( zelf, other, vm) )
463+ Self :: inplace_concat ( zelf, other, vm)
466464 } ) ,
467465 inplace_repeat : Some ( |seq, n, vm| {
468466 let zelf = Self :: sequence_downcast ( seq) ;
0 commit comments