From 6c745f68dd6d123fc491cc513429ede529fa3a2e Mon Sep 17 00:00:00 2001 From: Jimmy Girardet Date: Tue, 9 Apr 2019 14:43:13 +0200 Subject: [PATCH] fix typo, fix bytesinner.add now return Vec[u8] --- vm/src/obj/objbyteinner.rs | 6 +++--- vm/src/obj/objbytes.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vm/src/obj/objbyteinner.rs b/vm/src/obj/objbyteinner.rs index 14da2521e..bcb1f8207 100644 --- a/vm/src/obj/objbyteinner.rs +++ b/vm/src/obj/objbyteinner.rs @@ -55,7 +55,7 @@ impl PyByteInner { } else { return Err(vm.new_type_error("encoding without a string argument".to_string())); } - // On ly one argument + // Only one argument } else { let value = if let OptionalArg::Present(ival) = val_option { match_class!(ival.clone(), @@ -161,14 +161,14 @@ impl PyByteInner { hasher.finish() as usize } - pub fn add(&self, other: &PyByteInner, vm: &VirtualMachine) -> PyResult { + pub fn add(&self, other: &PyByteInner, _vm: &VirtualMachine) -> Vec { let elements: Vec = self .elements .iter() .chain(other.elements.iter()) .cloned() .collect(); - Ok(vm.ctx.new_bytes(elements)) + elements } pub fn contains_bytes(&self, other: &PyByteInner, vm: &VirtualMachine) -> PyResult { diff --git a/vm/src/obj/objbytes.rs b/vm/src/obj/objbytes.rs index 83ce3b8fb..0b257cb77 100644 --- a/vm/src/obj/objbytes.rs +++ b/vm/src/obj/objbytes.rs @@ -134,7 +134,7 @@ impl PyBytesRef { #[pymethod(name = "__add__")] fn add(self, other: PyObjectRef, vm: &VirtualMachine) -> PyResult { match_class!(other, - bytes @ PyBytes => self.inner.add(&bytes.inner, vm), + bytes @ PyBytes => Ok(vm.ctx.new_bytes(self.inner.add(&bytes.inner, vm))), _ => Ok(vm.ctx.not_implemented())) }