forked from Rust-related/RustPython
Mark PyBoundMethod, PyFunction as ThreadSafe
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user