We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aad9015 commit 7da7929Copy full SHA for 7da7929
vm/src/builtins/str.rs
@@ -48,6 +48,13 @@ impl<'a> TryFromBorrowedObject<'a> for String {
48
}
49
50
51
+impl<'a> TryFromBorrowedObject<'a> for &'a str {
52
+ fn try_from_borrowed_object(vm: &VirtualMachine, obj: &'a PyObject) -> PyResult<Self> {
53
+ let pystr: &Py<PyStr> = TryFromBorrowedObject::try_from_borrowed_object(vm, obj)?;
54
+ Ok(pystr.as_str())
55
+ }
56
+}
57
+
58
#[pyclass(module = false, name = "str")]
59
pub struct PyStr {
60
bytes: Box<[u8]>,
0 commit comments