Mark PyBoundMethod, PyFunction as ThreadSafe

This commit is contained in:
Aviv Palivoda
2020-04-25 13:26:30 +03:00
parent e8dfffa597
commit cef268916b

View File

@@ -11,7 +11,7 @@ use crate::obj::objcoroutine::PyCoroutine;
use crate::obj::objgenerator::PyGenerator;
use crate::pyobject::{
IdProtocol, ItemProtocol, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue,
TypeProtocol,
ThreadSafe, TypeProtocol,
};
use crate::scope::Scope;
use crate::slots::{SlotCall, SlotDescriptor};
@@ -28,6 +28,7 @@ pub struct PyFunction {
defaults: Option<PyTupleRef>,
kw_only_defaults: Option<PyDictRef>,
}
impl ThreadSafe for PyFunction {}
impl SlotDescriptor for PyFunction {
fn descr_get(
@@ -293,6 +294,8 @@ pub struct PyBoundMethod {
pub function: PyObjectRef,
}
impl ThreadSafe for PyBoundMethod {}
impl SlotCall for PyBoundMethod {
fn call(&self, args: PyFuncArgs, vm: &VirtualMachine) -> PyResult {
let args = args.insert(self.object.clone());