@@ -138,23 +138,21 @@ impl PyList {
138
138
self . concat ( & other, vm)
139
139
}
140
140
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 ( ) )
148
149
}
149
150
150
151
#[ 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)
158
156
}
159
157
160
158
#[ pymethod( magic) ]
@@ -462,7 +460,7 @@ impl AsSequence for PyList {
462
460
} ) ,
463
461
inplace_concat : Some ( |seq, other, vm| {
464
462
let zelf = Self :: sequence_downcast ( seq) ;
465
- Ok ( Self :: inplace_concat ( zelf, other, vm) )
463
+ Self :: inplace_concat ( zelf, other, vm)
466
464
} ) ,
467
465
inplace_repeat : Some ( |seq, n, vm| {
468
466
let zelf = Self :: sequence_downcast ( seq) ;
0 commit comments