Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add vm to imul signature, fix return type, formatting fixes.
  • Loading branch information
philippeitis authored and philippeitis committed Feb 27, 2020
commit 1f9eae69fc182933bfd6c92909091ca6cb855065
8 changes: 4 additions & 4 deletions vm/src/obj/objlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ impl PyList {
.collect();
return Ok(vm.ctx.new_list(new_elements));
}
return Err(vm.new_memory_error("".to_owned()));
Err(vm.new_memory_error("".to_owned()))
}

#[pymethod(name = "__rmul__")]
Expand All @@ -486,15 +486,15 @@ impl PyList {
}

#[pymethod(name = "__imul__")]
fn imul(zelf: PyRef<Self>, counter: isize) -> PyResult<Self> {
fn imul(zelf: PyRef<Self>, counter: isize, vm: &VirtualMachine) -> PyResult<PyRef<Self>> {
if counter < 0 || zelf.len() * (counter as usize) < MAX_MEMORY_SIZE {
let new_elements = sequence::seq_mul(&zelf.borrow_sequence(), counter)
.cloned()
.collect();
zelf.elements.replace(new_elements);
return Ok(*zelf);
return Ok(zelf);
}
return Err(vm.new_memory_error("".to_owned()));
Err(vm.new_memory_error("".to_owned()))
}

#[pymethod]
Expand Down
2 changes: 1 addition & 1 deletion vm/src/obj/objstr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ impl PyString {
vm.new_overflow_error("cannot fit 'int' into an index-sized integer".to_owned())
});
}
return Err(vm.new_memory_error("".to_owned()));
Err(vm.new_memory_error("".to_owned()))
}

#[pymethod(name = "__rmul__")]
Expand Down