We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bfe3d8b commit 08fbe7aCopy full SHA for 08fbe7a
crates/vm/src/builtins/bytes.rs
@@ -224,6 +224,12 @@ impl PyBytes {
224
size_of::<Self>() + self.len() * size_of::<u8>()
225
}
226
227
+ #[pymethod]
228
+ fn __str__(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyStrRef> {
229
+ PyBytesInner::warn_on_str("str() on a bytes instance", vm)?;
230
+ Ok(vm.ctx.new_str(zelf.inner.repr_bytes(vm)?))
231
+ }
232
+
233
fn __add__(&self, other: ArgBytesLike) -> Vec<u8> {
234
self.inner.add(&other.borrow_buf())
235
0 commit comments