Skip to content

Commit 6db40d6

Browse files
committed
Provide slot accessor to all Py<T> implemtations
1 parent 6eb4e57 commit 6db40d6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

vm/src/object/core.rs

+8
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,14 @@ impl<T: PyObjectPayload> Py<T> {
872872
_marker: PhantomData,
873873
})
874874
}
875+
876+
pub(crate) fn get_slot(&self, offset: usize) -> Option<PyObjectRef> {
877+
self.0.slots[offset].read().clone()
878+
}
879+
880+
pub(crate) fn set_slot(&self, offset: usize, value: Option<PyObjectRef>) {
881+
*self.0.slots[offset].write() = value;
882+
}
875883
}
876884

877885
impl<T: PyObjectPayload> ToOwned for Py<T> {

0 commit comments

Comments
 (0)