diff --git a/stdlib/src/array.rs b/stdlib/src/array.rs index b9481eaba..5becd160d 100644 --- a/stdlib/src/array.rs +++ b/stdlib/src/array.rs @@ -746,7 +746,7 @@ mod array { } #[pymethod] - fn append(zelf: PyRef, x: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> { + fn append(zelf: &Py, x: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> { zelf.try_resizable(vm)?.push(x, vm) } @@ -762,12 +762,12 @@ mod array { } #[pymethod] - fn remove(zelf: PyRef, x: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> { + fn remove(zelf: &Py, x: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> { zelf.try_resizable(vm)?.remove(x, vm) } #[pymethod] - fn extend(zelf: PyRef, obj: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> { + fn extend(zelf: &Py, obj: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> { let mut w = zelf.try_resizable(vm)?; if zelf.is(&obj) { w.imul(2, vm) @@ -828,7 +828,7 @@ mod array { } #[pymethod] - fn fromunicode(zelf: PyRef, obj: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> { + fn fromunicode(zelf: &Py, obj: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> { let utf8 = PyStrRef::try_from_object(vm, obj.clone()).map_err(|_| { vm.new_type_error(format!( "fromunicode() argument must be str, not {}", @@ -922,18 +922,13 @@ mod array { } #[pymethod] - fn insert( - zelf: PyRef, - i: isize, - x: PyObjectRef, - vm: &VirtualMachine, - ) -> PyResult<()> { + fn insert(zelf: &Py, i: isize, x: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> { let mut w = zelf.try_resizable(vm)?; w.insert(i, x, vm) } #[pymethod] - fn pop(zelf: PyRef, i: OptionalArg, vm: &VirtualMachine) -> PyResult { + fn pop(zelf: &Py, i: OptionalArg, vm: &VirtualMachine) -> PyResult { let mut w = zelf.try_resizable(vm)?; if w.len() == 0 { Err(vm.new_index_error("pop from empty array".to_owned())) @@ -982,7 +977,7 @@ mod array { } #[pymethod] - fn fromlist(zelf: PyRef, list: PyListRef, vm: &VirtualMachine) -> PyResult<()> { + fn fromlist(zelf: &Py, list: PyListRef, vm: &VirtualMachine) -> PyResult<()> { zelf.try_resizable(vm)?.fromlist(&list, vm) } @@ -1014,7 +1009,7 @@ mod array { } fn _setitem( - zelf: PyRef, + zelf: &Py, needle: &PyObject, value: PyObjectRef, vm: &VirtualMachine, @@ -1052,7 +1047,7 @@ mod array { #[pymethod(magic)] fn setitem( - zelf: PyRef, + zelf: &Py, needle: PyObjectRef, value: PyObjectRef, vm: &VirtualMachine, @@ -1120,7 +1115,7 @@ mod array { } #[pymethod(magic)] - fn repr(zelf: PyRef, vm: &VirtualMachine) -> PyResult { + fn repr(zelf: &Py, vm: &VirtualMachine) -> PyResult { let class = zelf.class(); let class_name = class.name(); if zelf.read().typecode() == 'u' { @@ -1167,7 +1162,7 @@ mod array { #[pymethod(magic)] fn reduce_ex( - zelf: PyRef, + zelf: &Py, proto: usize, vm: &VirtualMachine, ) -> PyResult<(PyObjectRef, PyTupleRef, Option)> { @@ -1191,7 +1186,7 @@ mod array { #[pymethod(magic)] fn reduce( - zelf: PyRef, + zelf: &Py, vm: &VirtualMachine, ) -> PyResult<(PyObjectRef, PyTupleRef, Option)> { let array = zelf.read(); @@ -1325,7 +1320,7 @@ mod array { ass_subscript: atomic_func!(|mapping, needle, value, vm| { let zelf = PyArray::mapping_downcast(mapping); if let Some(value) = value { - PyArray::_setitem(zelf.to_owned(), needle, value, vm) + PyArray::_setitem(zelf, needle, value, vm) } else { zelf._delitem(needle, vm) }