We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0723271 commit 62d071fCopy full SHA for 62d071f
vm/src/builtins/list.rs
@@ -300,7 +300,8 @@ impl PyList {
300
301
if let Some(index) = index.into() {
302
// defer delete out of borrow
303
- Ok(self.borrow_vec_mut().remove(index))
+ let mut elements = self.borrow_vec_mut();
304
+ Ok((index < elements.len()).then(move || elements.remove(index)))
305
} else {
306
Err(vm.new_value_error(format!("'{}' is not in list", needle.str(vm)?)))
307
}
0 commit comments