Skip to content

Commit 6dfe2f9

Browse files
committed
Mark PyWeakProxy,PyWeak as ThreadSafe
1 parent 59197cd commit 6dfe2f9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

vm/src/obj/objweakproxy.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::objtype::PyClassRef;
22
use super::objweakref::PyWeak;
33
use crate::function::OptionalArg;
4-
use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue};
4+
use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe};
55
use crate::vm::VirtualMachine;
66

77
#[pyclass]
@@ -10,6 +10,8 @@ pub struct PyWeakProxy {
1010
weak: PyWeak,
1111
}
1212

13+
impl ThreadSafe for PyWeakProxy {}
14+
1315
impl PyValue for PyWeakProxy {
1416
fn class(vm: &VirtualMachine) -> PyClassRef {
1517
vm.ctx.weakproxy_type()

vm/src/obj/objweakref.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use super::objtype::PyClassRef;
22
use crate::function::{OptionalArg, PyFuncArgs};
33
use crate::pyobject::{
44
PyClassImpl, PyContext, PyObject, PyObjectPayload, PyObjectRef, PyRef, PyResult, PyValue,
5+
ThreadSafe,
56
};
67
use crate::slots::SlotCall;
78
use crate::vm::VirtualMachine;
@@ -14,6 +15,8 @@ pub struct PyWeak {
1415
referent: Weak<PyObject<dyn PyObjectPayload>>,
1516
}
1617

18+
impl ThreadSafe for PyWeak {}
19+
1720
impl PyWeak {
1821
pub fn downgrade(obj: &PyObjectRef) -> PyWeak {
1922
PyWeak {

0 commit comments

Comments
 (0)