diff --git a/vm/src/obj/objlist.rs b/vm/src/obj/objlist.rs index 0afb44e39..d27593ebe 100644 --- a/vm/src/obj/objlist.rs +++ b/vm/src/obj/objlist.rs @@ -145,9 +145,9 @@ impl PyListRef { } fn iadd(self, other: PyObjectRef, vm: &VirtualMachine) -> PyResult { - if objtype::isinstance(&other, &vm.ctx.list_type()) { - let e = get_elements_list(&other).clone(); - self.elements.borrow_mut().extend_from_slice(&e); + if let Ok(new_elements) = vm.extract_elements(&other) { + let mut e = new_elements; + self.elements.borrow_mut().append(&mut e); Ok(self.into_object()) } else { Ok(vm.ctx.not_implemented())