Skip to content

Commit e03fb35

Browse files
committed
Make PyValue, PyObjectPayload Send + Sync
1 parent fd70851 commit e03fb35

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

vm/src/pyobject.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ impl PyObject<dyn PyObjectPayload> {
11931193
}
11941194
}
11951195

1196-
pub trait PyValue: fmt::Debug + Sized + 'static {
1196+
pub trait PyValue: fmt::Debug + Send + Sync + Sized + 'static {
11971197
const HAVE_DICT: bool = false;
11981198

11991199
fn class(vm: &VirtualMachine) -> PyClassRef;
@@ -1225,12 +1225,8 @@ pub trait PyValue: fmt::Debug + Sized + 'static {
12251225

12261226
// Temporary trait to follow the progress of threading conversion
12271227
pub trait ThreadSafe: Send + Sync {}
1228-
// Temporary hack to help with converting object that contain PyObjectRef to ThreadSafe.
1229-
// Should be removed before threading is allowed. Do not try this at home!!!
1230-
unsafe impl<T: ?Sized + PyObjectPayload> Send for PyObject<T> {}
1231-
unsafe impl<T: ?Sized + PyObjectPayload> Sync for PyObject<T> {}
12321228

1233-
pub trait PyObjectPayload: Any + fmt::Debug + 'static {
1229+
pub trait PyObjectPayload: Any + fmt::Debug + Send + Sync + 'static {
12341230
fn as_any(&self) -> &dyn Any;
12351231
}
12361232

0 commit comments

Comments
 (0)