Skip to content

Commit 6e89c6e

Browse files
committed
Mark PyByteInner and PyBytes as ThreadSafe
1 parent 2c5237b commit 6e89c6e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

vm/src/obj/objbyteinner.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ use super::objtuple::PyTupleRef;
1818
use crate::function::OptionalArg;
1919
use crate::pyhash;
2020
use crate::pyobject::{
21-
Either, PyComparisonValue, PyIterable, PyObjectRef, PyResult, TryFromObject, TypeProtocol,
21+
Either, PyComparisonValue, PyIterable, PyObjectRef, PyResult, ThreadSafe, TryFromObject,
22+
TypeProtocol,
2223
};
2324
use crate::vm::VirtualMachine;
2425

@@ -27,6 +28,8 @@ pub struct PyByteInner {
2728
pub elements: Vec<u8>,
2829
}
2930

31+
impl ThreadSafe for PyByteInner {}
32+
3033
impl TryFromObject for PyByteInner {
3134
fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self> {
3235
match_class!(match obj {

vm/src/obj/objbytes.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::pyobject::{
2121
Either, IntoPyObject,
2222
PyArithmaticValue::{self, *},
2323
PyClassImpl, PyComparisonValue, PyContext, PyIterable, PyObjectRef, PyRef, PyResult, PyValue,
24-
TryFromObject, TypeProtocol,
24+
ThreadSafe, TryFromObject, TypeProtocol,
2525
};
2626
use crate::vm::VirtualMachine;
2727
use std::str::FromStr;
@@ -40,6 +40,9 @@ use std::str::FromStr;
4040
pub struct PyBytes {
4141
inner: PyByteInner,
4242
}
43+
44+
impl ThreadSafe for PyBytes {}
45+
4346
pub type PyBytesRef = PyRef<PyBytes>;
4447

4548
impl PyBytes {

0 commit comments

Comments
 (0)