mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-17 01:51:39 +09:00
fix typo, fix bytesinner.add now return Vec[u8]
This commit is contained in:
@@ -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<u8> {
|
||||
let elements: Vec<u8> = 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 {
|
||||
|
||||
@@ -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()))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user