mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
Fixed list's __iadd__
When list iadd iterable value, run iterator and add values to the list Fixes #1475
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user