Skip to content

Commit cef2689

Browse files
committed
Mark PyBoundMethod, PyFunction as ThreadSafe
1 parent e8dfffa commit cef2689

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

vm/src/obj/objfunction.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::obj::objcoroutine::PyCoroutine;
1111
use crate::obj::objgenerator::PyGenerator;
1212
use crate::pyobject::{
1313
IdProtocol, ItemProtocol, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue,
14-
TypeProtocol,
14+
ThreadSafe, TypeProtocol,
1515
};
1616
use crate::scope::Scope;
1717
use crate::slots::{SlotCall, SlotDescriptor};
@@ -28,6 +28,7 @@ pub struct PyFunction {
2828
defaults: Option<PyTupleRef>,
2929
kw_only_defaults: Option<PyDictRef>,
3030
}
31+
impl ThreadSafe for PyFunction {}
3132

3233
impl SlotDescriptor for PyFunction {
3334
fn descr_get(
@@ -293,6 +294,8 @@ pub struct PyBoundMethod {
293294
pub function: PyObjectRef,
294295
}
295296

297+
impl ThreadSafe for PyBoundMethod {}
298+
296299
impl SlotCall for PyBoundMethod {
297300
fn call(&self, args: PyFuncArgs, vm: &VirtualMachine) -> PyResult {
298301
let args = args.insert(self.object.clone());

0 commit comments

Comments
 (0)