◐ Shell
reader mode source ↗
Skip to content
Merged
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
16 changes: 15 additions & 1 deletion vm/src/function/buffer.rs
Original file line number Diff line number Diff line change
@@ -2,7 +2,8 @@ use crate::{
builtins::{PyStr, PyStrRef},
common::borrow::{BorrowedValue, BorrowedValueMut},
protocol::PyBuffer,
PyObject, PyObjectRef, PyResult, TryFromBorrowedObject, TryFromObject, VirtualMachine,
};

// Python/getargs.c
Expand Down Expand Up @@ -57,6 +58,10 @@ impl ArgBytesLike {
pub fn is_empty(&self) -> bool {
self.len() == 0
}
}

impl From<ArgBytesLike> for PyBuffer {
Expand Down Expand Up @@ -126,6 +131,15 @@ pub enum ArgStrOrBytesLike {
Str(PyStrRef),
}

impl TryFromObject for ArgStrOrBytesLike {
fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self> {
obj.downcast()
Expand Down
Toggle all file notes Toggle all file annotations