forked from Rust-related/RustPython
Remove ThreadSafe trait
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::obj::objstr::PyString;
|
||||
use crate::pyhash;
|
||||
use crate::pyobject::{IdProtocol, IntoPyObject, PyObjectRef, PyResult, ThreadSafe};
|
||||
use crate::pyobject::{IdProtocol, IntoPyObject, PyObjectRef, PyResult};
|
||||
use crate::vm::VirtualMachine;
|
||||
use num_bigint::ToBigInt;
|
||||
/// Ordered dictionary implementation.
|
||||
@@ -23,8 +23,6 @@ pub struct Dict<T = PyObjectRef> {
|
||||
inner: RwLock<InnerDict<T>>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for Dict {}
|
||||
|
||||
struct InnerDict<T> {
|
||||
size: usize,
|
||||
indices: HashMap<HashIndex, EntryIndex>,
|
||||
|
||||
@@ -6,8 +6,8 @@ use crate::obj::objtuple::{PyTuple, PyTupleRef};
|
||||
use crate::obj::objtype::{self, PyClass, PyClassRef};
|
||||
use crate::py_serde;
|
||||
use crate::pyobject::{
|
||||
PyClassImpl, PyContext, PyIterable, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe,
|
||||
TryFromObject, TypeProtocol,
|
||||
PyClassImpl, PyContext, PyIterable, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject,
|
||||
TypeProtocol,
|
||||
};
|
||||
use crate::slots::PyTpFlags;
|
||||
use crate::types::create_type;
|
||||
@@ -30,8 +30,6 @@ pub struct PyBaseException {
|
||||
args: RwLock<PyTupleRef>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyBaseException {}
|
||||
|
||||
impl fmt::Debug for PyBaseException {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
// TODO: implement more detailed, non-recursive Debug formatter
|
||||
|
||||
@@ -4,7 +4,7 @@ use super::objtype::{self, PyClassRef};
|
||||
use crate::exceptions::PyBaseExceptionRef;
|
||||
use crate::frame::FrameRef;
|
||||
use crate::function::OptionalArg;
|
||||
use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe};
|
||||
use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
use crossbeam_utils::atomic::AtomicCell;
|
||||
@@ -16,7 +16,6 @@ pub struct PyAsyncGen {
|
||||
running_async: AtomicCell<bool>,
|
||||
}
|
||||
pub type PyAsyncGenRef = PyRef<PyAsyncGen>;
|
||||
impl ThreadSafe for PyAsyncGen {}
|
||||
|
||||
impl PyValue for PyAsyncGen {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
@@ -164,8 +163,6 @@ struct PyAsyncGenASend {
|
||||
value: PyObjectRef,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyAsyncGenASend {}
|
||||
|
||||
impl PyValue for PyAsyncGenASend {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.ctx.types.async_generator_asend.clone()
|
||||
@@ -262,8 +259,6 @@ struct PyAsyncGenAThrow {
|
||||
value: (PyObjectRef, PyObjectRef, PyObjectRef),
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyAsyncGenAThrow {}
|
||||
|
||||
impl PyValue for PyAsyncGenAThrow {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.ctx.types.async_generator_athrow.clone()
|
||||
|
||||
@@ -3,7 +3,7 @@ use std::fmt;
|
||||
use crate::function::{OptionalArg, PyFuncArgs, PyNativeFunc};
|
||||
use crate::obj::objtype::PyClassRef;
|
||||
use crate::pyobject::{
|
||||
IdProtocol, PyClassImpl, PyContext, PyObjectRef, PyResult, PyValue, ThreadSafe, TypeProtocol,
|
||||
IdProtocol, PyClassImpl, PyContext, PyObjectRef, PyResult, PyValue, TypeProtocol,
|
||||
};
|
||||
use crate::slots::{SlotCall, SlotDescriptor};
|
||||
use crate::vm::VirtualMachine;
|
||||
@@ -12,7 +12,6 @@ use crate::vm::VirtualMachine;
|
||||
pub struct PyBuiltinFunction {
|
||||
value: PyNativeFunc,
|
||||
}
|
||||
impl ThreadSafe for PyBuiltinFunction {}
|
||||
|
||||
impl PyValue for PyBuiltinFunction {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
@@ -49,7 +48,6 @@ impl PyBuiltinFunction {}
|
||||
pub struct PyBuiltinMethod {
|
||||
function: PyBuiltinFunction,
|
||||
}
|
||||
impl ThreadSafe for PyBuiltinMethod {}
|
||||
|
||||
impl PyValue for PyBuiltinMethod {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
|
||||
@@ -21,7 +21,7 @@ use crate::function::{OptionalArg, OptionalOption};
|
||||
use crate::obj::objstr::do_cformat_string;
|
||||
use crate::pyobject::{
|
||||
Either, PyClassImpl, PyComparisonValue, PyContext, PyIterable, PyObjectRef, PyRef, PyResult,
|
||||
PyValue, ThreadSafe, TryFromObject, TypeProtocol,
|
||||
PyValue, TryFromObject, TypeProtocol,
|
||||
};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
@@ -42,8 +42,6 @@ pub struct PyByteArray {
|
||||
inner: RwLock<PyByteInner>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyByteArray {}
|
||||
|
||||
pub type PyByteArrayRef = PyRef<PyByteArray>;
|
||||
|
||||
impl PyByteArray {
|
||||
|
||||
@@ -17,8 +17,7 @@ use super::pystr::{self, PyCommonString, PyCommonStringWrapper};
|
||||
use crate::function::{OptionalArg, OptionalOption};
|
||||
use crate::pyhash;
|
||||
use crate::pyobject::{
|
||||
Either, PyComparisonValue, PyIterable, PyObjectRef, PyResult, ThreadSafe, TryFromObject,
|
||||
TypeProtocol,
|
||||
Either, PyComparisonValue, PyIterable, PyObjectRef, PyResult, TryFromObject, TypeProtocol,
|
||||
};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
@@ -33,8 +32,6 @@ impl From<Vec<u8>> for PyByteInner {
|
||||
}
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyByteInner {}
|
||||
|
||||
impl TryFromObject for PyByteInner {
|
||||
fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self> {
|
||||
match_class!(match obj {
|
||||
|
||||
@@ -22,7 +22,7 @@ use crate::pyobject::{
|
||||
Either, IntoPyObject,
|
||||
PyArithmaticValue::{self, *},
|
||||
PyClassImpl, PyComparisonValue, PyContext, PyIterable, PyObjectRef, PyRef, PyResult, PyValue,
|
||||
ThreadSafe, TryFromObject, TypeProtocol,
|
||||
TryFromObject, TypeProtocol,
|
||||
};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
@@ -41,8 +41,6 @@ pub struct PyBytes {
|
||||
inner: PyByteInner,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyBytes {}
|
||||
|
||||
pub type PyBytesRef = PyRef<PyBytes>;
|
||||
|
||||
impl PyBytes {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::objtype::PyClassRef;
|
||||
use crate::function::OptionalArg;
|
||||
use crate::pyobject::{
|
||||
PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe, TypeProtocol,
|
||||
PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, TypeProtocol,
|
||||
};
|
||||
use crate::slots::SlotDescriptor;
|
||||
use crate::vm::VirtualMachine;
|
||||
@@ -32,7 +32,6 @@ pub struct PyClassMethod {
|
||||
callable: PyObjectRef,
|
||||
}
|
||||
pub type PyClassMethodRef = PyRef<PyClassMethod>;
|
||||
impl ThreadSafe for PyClassMethod {}
|
||||
|
||||
impl PyClassMethod {
|
||||
pub fn new(value: PyObjectRef) -> Self {
|
||||
|
||||
@@ -7,9 +7,7 @@ use std::ops::Deref;
|
||||
|
||||
use super::objtype::PyClassRef;
|
||||
use crate::bytecode;
|
||||
use crate::pyobject::{
|
||||
IdProtocol, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe,
|
||||
};
|
||||
use crate::pyobject::{IdProtocol, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
pub type PyCodeRef = PyRef<PyCode>;
|
||||
@@ -19,8 +17,6 @@ pub struct PyCode {
|
||||
pub code: bytecode::CodeObject,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyCode {}
|
||||
|
||||
impl Deref for PyCode {
|
||||
type Target = bytecode::CodeObject;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
|
||||
@@ -7,7 +7,7 @@ use super::objtype::PyClassRef;
|
||||
use crate::function::OptionalArg;
|
||||
use crate::pyhash;
|
||||
use crate::pyobject::{
|
||||
IntoPyObject, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe,
|
||||
IntoPyObject, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue,
|
||||
};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
@@ -20,8 +20,6 @@ pub struct PyComplex {
|
||||
value: Complex64,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyComplex {}
|
||||
|
||||
type PyComplexRef = PyRef<PyComplex>;
|
||||
|
||||
impl PyValue for PyComplex {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::objtype::{self, PyClassRef};
|
||||
use crate::exceptions::{self, PyBaseExceptionRef};
|
||||
use crate::frame::{ExecutionResult, FrameRef};
|
||||
use crate::pyobject::{PyObjectRef, PyResult, ThreadSafe};
|
||||
use crate::pyobject::{PyObjectRef, PyResult};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
use crossbeam_utils::atomic::AtomicCell;
|
||||
@@ -42,8 +42,6 @@ pub struct Coro {
|
||||
variant: Variant,
|
||||
}
|
||||
|
||||
impl ThreadSafe for Coro {}
|
||||
|
||||
impl Coro {
|
||||
pub fn new(frame: FrameRef, variant: Variant) -> Self {
|
||||
Coro {
|
||||
|
||||
@@ -4,7 +4,7 @@ use super::objstr::PyStringRef;
|
||||
use super::objtype::PyClassRef;
|
||||
use crate::frame::FrameRef;
|
||||
use crate::function::OptionalArg;
|
||||
use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe};
|
||||
use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
pub type PyCoroutineRef = PyRef<PyCoroutine>;
|
||||
@@ -15,8 +15,6 @@ pub struct PyCoroutine {
|
||||
inner: Coro,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyCoroutine {}
|
||||
|
||||
impl PyValue for PyCoroutine {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.ctx.types.coroutine_type.clone()
|
||||
@@ -103,8 +101,6 @@ pub struct PyCoroutineWrapper {
|
||||
coro: PyCoroutineRef,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyCoroutineWrapper {}
|
||||
|
||||
impl PyValue for PyCoroutineWrapper {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.ctx.types.coroutine_wrapper_type.clone()
|
||||
|
||||
@@ -10,7 +10,7 @@ use crate::exceptions::PyBaseExceptionRef;
|
||||
use crate::function::{KwArgs, OptionalArg, PyFuncArgs};
|
||||
use crate::pyobject::{
|
||||
IdProtocol, IntoPyObject, ItemProtocol, PyAttributes, PyClassImpl, PyContext, PyIterable,
|
||||
PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe,
|
||||
PyObjectRef, PyRef, PyResult, PyValue,
|
||||
};
|
||||
use crate::vm::{ReprGuard, VirtualMachine};
|
||||
|
||||
@@ -24,7 +24,6 @@ pub struct PyDict {
|
||||
entries: DictContentType,
|
||||
}
|
||||
pub type PyDictRef = PyRef<PyDict>;
|
||||
impl ThreadSafe for PyDict {}
|
||||
|
||||
impl fmt::Debug for PyDict {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
||||
@@ -8,7 +8,7 @@ use super::objint::PyIntRef;
|
||||
use super::objiter;
|
||||
use super::objtype::PyClassRef;
|
||||
use crate::function::OptionalArg;
|
||||
use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe};
|
||||
use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
#[pyclass]
|
||||
@@ -18,7 +18,6 @@ pub struct PyEnumerate {
|
||||
iterator: PyObjectRef,
|
||||
}
|
||||
type PyEnumerateRef = PyRef<PyEnumerate>;
|
||||
impl ThreadSafe for PyEnumerate {}
|
||||
|
||||
impl PyValue for PyEnumerate {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
use super::objbool;
|
||||
use super::objiter;
|
||||
use super::objtype::PyClassRef;
|
||||
use crate::pyobject::{
|
||||
IdProtocol, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe,
|
||||
};
|
||||
use crate::pyobject::{IdProtocol, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
pub type PyFilterRef = PyRef<PyFilter>;
|
||||
@@ -18,7 +16,6 @@ pub struct PyFilter {
|
||||
predicate: PyObjectRef,
|
||||
iterator: PyObjectRef,
|
||||
}
|
||||
impl ThreadSafe for PyFilter {}
|
||||
|
||||
impl PyValue for PyFilter {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
|
||||
@@ -12,7 +12,7 @@ use crate::function::{OptionalArg, OptionalOption};
|
||||
use crate::pyhash;
|
||||
use crate::pyobject::{
|
||||
IntoPyObject, PyArithmaticValue::*, PyClassImpl, PyComparisonValue, PyContext, PyObjectRef,
|
||||
PyRef, PyResult, PyValue, ThreadSafe, TryFromObject, TypeProtocol,
|
||||
PyRef, PyResult, PyValue, TryFromObject, TypeProtocol,
|
||||
};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
@@ -23,8 +23,6 @@ pub struct PyFloat {
|
||||
value: f64,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyFloat {}
|
||||
|
||||
impl PyFloat {
|
||||
pub fn to_f64(self) -> f64 {
|
||||
self.value
|
||||
|
||||
@@ -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,
|
||||
ThreadSafe, TypeProtocol,
|
||||
TypeProtocol,
|
||||
};
|
||||
use crate::scope::Scope;
|
||||
use crate::slots::{SlotCall, SlotDescriptor};
|
||||
@@ -28,7 +28,6 @@ pub struct PyFunction {
|
||||
defaults: Option<PyTupleRef>,
|
||||
kw_only_defaults: Option<PyDictRef>,
|
||||
}
|
||||
impl ThreadSafe for PyFunction {}
|
||||
|
||||
impl SlotDescriptor for PyFunction {
|
||||
fn descr_get(
|
||||
@@ -294,8 +293,6 @@ 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());
|
||||
|
||||
@@ -7,7 +7,7 @@ use super::objcoroinner::{Coro, Variant};
|
||||
use super::objtype::PyClassRef;
|
||||
use crate::frame::FrameRef;
|
||||
use crate::function::OptionalArg;
|
||||
use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe};
|
||||
use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
pub type PyGeneratorRef = PyRef<PyGenerator>;
|
||||
@@ -18,8 +18,6 @@ pub struct PyGenerator {
|
||||
inner: Coro,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyGenerator {}
|
||||
|
||||
impl PyValue for PyGenerator {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.ctx.generator_type()
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
use super::objtype::PyClassRef;
|
||||
use crate::function::{FunctionBox, OptionalArg, OwnedParam, RefParam};
|
||||
use crate::pyobject::{
|
||||
IntoPyObject, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe,
|
||||
TryFromObject, TypeProtocol,
|
||||
IntoPyObject, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject,
|
||||
TypeProtocol,
|
||||
};
|
||||
use crate::slots::SlotDescriptor;
|
||||
use crate::vm::VirtualMachine;
|
||||
@@ -152,8 +152,6 @@ pub struct PyGetSet {
|
||||
// doc: Option<String>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyGetSet {}
|
||||
|
||||
impl std::fmt::Debug for PyGetSet {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
|
||||
@@ -18,7 +18,7 @@ use crate::function::{OptionalArg, PyFuncArgs};
|
||||
use crate::pyhash;
|
||||
use crate::pyobject::{
|
||||
IdProtocol, IntoPyObject, PyArithmaticValue, PyClassImpl, PyComparisonValue, PyContext,
|
||||
PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe, TryFromObject, TypeProtocol,
|
||||
PyObjectRef, PyRef, PyResult, PyValue, TryFromObject, TypeProtocol,
|
||||
};
|
||||
use crate::stdlib::array::PyArray;
|
||||
use crate::vm::VirtualMachine;
|
||||
@@ -43,8 +43,6 @@ pub struct PyInt {
|
||||
value: BigInt,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyInt {}
|
||||
|
||||
impl fmt::Display for PyInt {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
BigInt::fmt(&self.value, f)
|
||||
|
||||
@@ -10,8 +10,8 @@ use super::objsequence;
|
||||
use super::objtype::{self, PyClassRef};
|
||||
use crate::exceptions::PyBaseExceptionRef;
|
||||
use crate::pyobject::{
|
||||
PyCallable, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe,
|
||||
TryFromObject, TypeProtocol,
|
||||
PyCallable, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject,
|
||||
TypeProtocol,
|
||||
};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
@@ -145,7 +145,6 @@ pub struct PySequenceIterator {
|
||||
pub obj: PyObjectRef,
|
||||
pub reversed: bool,
|
||||
}
|
||||
impl ThreadSafe for PySequenceIterator {}
|
||||
|
||||
impl PyValue for PySequenceIterator {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
@@ -219,7 +218,6 @@ pub struct PyCallableIterator {
|
||||
sentinel: PyObjectRef,
|
||||
done: AtomicCell<bool>,
|
||||
}
|
||||
impl ThreadSafe for PyCallableIterator {}
|
||||
|
||||
impl PyValue for PyCallableIterator {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
|
||||
@@ -17,7 +17,7 @@ use super::objtype::PyClassRef;
|
||||
use crate::function::OptionalArg;
|
||||
use crate::pyobject::{
|
||||
IdProtocol, PyArithmaticValue::*, PyClassImpl, PyComparisonValue, PyContext, PyIterable,
|
||||
PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe, TryFromObject, TypeProtocol,
|
||||
PyObjectRef, PyRef, PyResult, PyValue, TryFromObject, TypeProtocol,
|
||||
};
|
||||
use crate::sequence::{self, SimpleSeq};
|
||||
use crate::vm::{ReprGuard, VirtualMachine};
|
||||
@@ -32,8 +32,6 @@ pub struct PyList {
|
||||
elements: RwLock<Vec<PyObjectRef>>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyList {}
|
||||
|
||||
impl fmt::Debug for PyList {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
// TODO: implement more detailed, non-recursive Debug formatter
|
||||
@@ -876,8 +874,6 @@ pub struct PyListIterator {
|
||||
pub list: PyListRef,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyListIterator {}
|
||||
|
||||
impl PyValue for PyListIterator {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.ctx.listiterator_type()
|
||||
@@ -917,8 +913,6 @@ pub struct PyListReverseIterator {
|
||||
pub list: PyListRef,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyListReverseIterator {}
|
||||
|
||||
impl PyValue for PyListReverseIterator {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.ctx.listreverseiterator_type()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::objiter;
|
||||
use super::objtype::PyClassRef;
|
||||
use crate::function::Args;
|
||||
use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe};
|
||||
use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
/// map(func, *iterables) --> map object
|
||||
@@ -15,7 +15,6 @@ pub struct PyMap {
|
||||
iterators: Vec<PyObjectRef>,
|
||||
}
|
||||
type PyMapRef = PyRef<PyMap>;
|
||||
impl ThreadSafe for PyMap {}
|
||||
|
||||
impl PyValue for PyMap {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
|
||||
@@ -4,8 +4,7 @@ use super::objstr::PyStringRef;
|
||||
use super::objtype::PyClassRef;
|
||||
use crate::function::OptionalArg;
|
||||
use crate::pyobject::{
|
||||
ItemProtocol, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe,
|
||||
TryFromObject,
|
||||
ItemProtocol, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject,
|
||||
};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
@@ -14,7 +13,6 @@ use crate::vm::VirtualMachine;
|
||||
pub struct PyMappingProxy {
|
||||
mapping: MappingProxyInner,
|
||||
}
|
||||
impl ThreadSafe for PyMappingProxy {}
|
||||
|
||||
#[derive(Debug)]
|
||||
enum MappingProxyInner {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::objbyteinner::try_as_byte;
|
||||
use super::objtype::{issubclass, PyClassRef};
|
||||
use crate::pyobject::{
|
||||
PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe, TypeProtocol,
|
||||
PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, TypeProtocol,
|
||||
};
|
||||
use crate::stdlib::array::PyArray;
|
||||
use crate::vm::VirtualMachine;
|
||||
@@ -11,7 +11,6 @@ use crate::vm::VirtualMachine;
|
||||
pub struct PyMemoryView {
|
||||
obj_ref: PyObjectRef,
|
||||
}
|
||||
impl ThreadSafe for PyMemoryView {}
|
||||
|
||||
pub type PyMemoryViewRef = PyRef<PyMemoryView>;
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@ use std::sync::RwLock;
|
||||
use super::objtype::PyClassRef;
|
||||
use crate::function::OptionalArg;
|
||||
use crate::pyobject::{
|
||||
IdProtocol, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe,
|
||||
TypeProtocol,
|
||||
IdProtocol, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, TypeProtocol,
|
||||
};
|
||||
use crate::slots::SlotDescriptor;
|
||||
use crate::vm::VirtualMachine;
|
||||
@@ -52,7 +51,6 @@ pub struct PyProperty {
|
||||
deleter: Option<PyObjectRef>,
|
||||
doc: RwLock<Option<PyObjectRef>>,
|
||||
}
|
||||
impl ThreadSafe for PyProperty {}
|
||||
|
||||
impl PyValue for PyProperty {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
|
||||
@@ -12,8 +12,7 @@ use super::objtype::PyClassRef;
|
||||
use crate::function::{OptionalArg, PyFuncArgs};
|
||||
use crate::pyhash;
|
||||
use crate::pyobject::{
|
||||
PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe, TryFromObject,
|
||||
TypeProtocol,
|
||||
PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject, TypeProtocol,
|
||||
};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
@@ -32,7 +31,6 @@ pub struct PyRange {
|
||||
pub stop: PyIntRef,
|
||||
pub step: PyIntRef,
|
||||
}
|
||||
impl ThreadSafe for PyRange {}
|
||||
|
||||
impl PyValue for PyRange {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
@@ -405,7 +403,6 @@ pub struct PyRangeIterator {
|
||||
position: AtomicCell<usize>,
|
||||
range: PyRangeRef,
|
||||
}
|
||||
impl ThreadSafe for PyRangeIterator {}
|
||||
|
||||
impl PyValue for PyRangeIterator {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
|
||||
@@ -9,8 +9,8 @@ use crate::dictdatatype;
|
||||
use crate::function::{Args, OptionalArg};
|
||||
use crate::pyhash;
|
||||
use crate::pyobject::{
|
||||
PyClassImpl, PyContext, PyIterable, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe,
|
||||
TryFromObject, TypeProtocol,
|
||||
PyClassImpl, PyContext, PyIterable, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject,
|
||||
TypeProtocol,
|
||||
};
|
||||
use crate::vm::{ReprGuard, VirtualMachine};
|
||||
|
||||
@@ -26,7 +26,6 @@ pub struct PySet {
|
||||
inner: PySetInner,
|
||||
}
|
||||
pub type PySetRef = PyRef<PySet>;
|
||||
impl ThreadSafe for PySet {}
|
||||
|
||||
/// frozenset() -> empty frozenset object
|
||||
/// frozenset(iterable) -> frozenset object
|
||||
@@ -38,7 +37,6 @@ pub struct PyFrozenSet {
|
||||
inner: PySetInner,
|
||||
}
|
||||
pub type PyFrozenSetRef = PyRef<PyFrozenSet>;
|
||||
impl ThreadSafe for PyFrozenSet {}
|
||||
|
||||
impl fmt::Debug for PySet {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
||||
@@ -2,8 +2,7 @@ use super::objint::PyInt;
|
||||
use super::objtype::PyClassRef;
|
||||
use crate::function::{OptionalArg, PyFuncArgs};
|
||||
use crate::pyobject::{
|
||||
IdProtocol, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe,
|
||||
TryIntoRef,
|
||||
IdProtocol, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, TryIntoRef,
|
||||
};
|
||||
use crate::vm::VirtualMachine;
|
||||
use num_bigint::{BigInt, ToBigInt};
|
||||
@@ -16,7 +15,6 @@ pub struct PySlice {
|
||||
pub stop: PyObjectRef,
|
||||
pub step: Option<PyObjectRef>,
|
||||
}
|
||||
impl ThreadSafe for PySlice {}
|
||||
|
||||
impl PyValue for PySlice {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use super::objtype::PyClassRef;
|
||||
use crate::function::OptionalArg;
|
||||
use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe};
|
||||
use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue};
|
||||
use crate::slots::SlotDescriptor;
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
@@ -10,7 +10,6 @@ pub struct PyStaticMethod {
|
||||
pub callable: PyObjectRef,
|
||||
}
|
||||
pub type PyStaticMethodRef = PyRef<PyStaticMethod>;
|
||||
impl ThreadSafe for PyStaticMethod {}
|
||||
|
||||
impl PyValue for PyStaticMethod {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
|
||||
@@ -31,7 +31,7 @@ use crate::function::{OptionalArg, OptionalOption, PyFuncArgs};
|
||||
use crate::pyhash;
|
||||
use crate::pyobject::{
|
||||
Either, IdProtocol, IntoPyObject, ItemProtocol, PyClassImpl, PyContext, PyIterable,
|
||||
PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe, TryFromObject, TryIntoRef, TypeProtocol,
|
||||
PyObjectRef, PyRef, PyResult, PyValue, TryFromObject, TryIntoRef, TypeProtocol,
|
||||
};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
@@ -52,7 +52,6 @@ pub struct PyString {
|
||||
hash: AtomicCell<Option<pyhash::PyHash>>,
|
||||
len: AtomicCell<Option<usize>>,
|
||||
}
|
||||
impl ThreadSafe for PyString {}
|
||||
|
||||
impl PyString {
|
||||
#[inline]
|
||||
@@ -103,7 +102,6 @@ pub struct PyStringIterator {
|
||||
pub string: PyStringRef,
|
||||
position: AtomicCell<usize>,
|
||||
}
|
||||
impl ThreadSafe for PyStringIterator {}
|
||||
|
||||
impl PyValue for PyStringIterator {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
@@ -137,7 +135,6 @@ pub struct PyStringReverseIterator {
|
||||
pub position: AtomicCell<isize>,
|
||||
pub string: PyStringRef,
|
||||
}
|
||||
impl ThreadSafe for PyStringReverseIterator {}
|
||||
|
||||
impl PyValue for PyStringReverseIterator {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
|
||||
@@ -10,8 +10,8 @@ use super::objstr::PyStringRef;
|
||||
use super::objtype::{self, PyClass, PyClassRef};
|
||||
use crate::function::OptionalArg;
|
||||
use crate::pyobject::{
|
||||
IdProtocol, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe,
|
||||
TryFromObject, TypeProtocol,
|
||||
IdProtocol, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject,
|
||||
TypeProtocol,
|
||||
};
|
||||
use crate::scope::NameProtocol;
|
||||
use crate::slots::SlotDescriptor;
|
||||
@@ -27,7 +27,6 @@ pub struct PySuper {
|
||||
typ: PyClassRef,
|
||||
obj: Option<(PyObjectRef, PyClassRef)>,
|
||||
}
|
||||
impl ThreadSafe for PySuper {}
|
||||
|
||||
impl PyValue for PySuper {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::frame::FrameRef;
|
||||
use crate::obj::objtype::PyClassRef;
|
||||
use crate::pyobject::{PyClassImpl, PyContext, PyRef, PyValue, ThreadSafe};
|
||||
use crate::pyobject::{PyClassImpl, PyContext, PyRef, PyValue};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
#[pyclass]
|
||||
@@ -11,7 +11,6 @@ pub struct PyTraceback {
|
||||
pub lasti: usize,
|
||||
pub lineno: usize,
|
||||
}
|
||||
impl ThreadSafe for PyTraceback {}
|
||||
|
||||
pub type PyTracebackRef = PyRef<PyTraceback>;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::pyhash;
|
||||
use crate::pyobject::{
|
||||
IntoPyObject,
|
||||
PyArithmaticValue::{self, *},
|
||||
PyClassImpl, PyComparisonValue, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe,
|
||||
PyClassImpl, PyComparisonValue, PyContext, PyObjectRef, PyRef, PyResult, PyValue,
|
||||
};
|
||||
use crate::sequence;
|
||||
use crate::vm::{ReprGuard, VirtualMachine};
|
||||
@@ -23,8 +23,6 @@ pub struct PyTuple {
|
||||
elements: Vec<PyObjectRef>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyTuple {}
|
||||
|
||||
impl fmt::Debug for PyTuple {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
// TODO: implement more informational, non-recursive Debug formatter
|
||||
@@ -249,8 +247,6 @@ pub struct PyTupleIterator {
|
||||
tuple: PyTupleRef,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyTupleIterator {}
|
||||
|
||||
impl PyValue for PyTupleIterator {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.ctx.tupleiterator_type()
|
||||
|
||||
@@ -12,7 +12,7 @@ use super::objweakref::PyWeak;
|
||||
use crate::function::{OptionalArg, PyFuncArgs};
|
||||
use crate::pyobject::{
|
||||
IdProtocol, PyAttributes, PyClassImpl, PyContext, PyIterable, PyObject, PyObjectRef, PyRef,
|
||||
PyResult, PyValue, ThreadSafe, TypeProtocol,
|
||||
PyResult, PyValue, TypeProtocol,
|
||||
};
|
||||
use crate::slots::{PyClassSlots, PyTpFlags};
|
||||
use crate::vm::VirtualMachine;
|
||||
@@ -32,8 +32,6 @@ pub struct PyClass {
|
||||
pub slots: RwLock<PyClassSlots>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyClass {}
|
||||
|
||||
impl fmt::Display for PyClass {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Display::fmt(&self.name, f)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::objtype::PyClassRef;
|
||||
use super::objweakref::PyWeak;
|
||||
use crate::function::OptionalArg;
|
||||
use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe};
|
||||
use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
#[pyclass]
|
||||
@@ -10,8 +10,6 @@ pub struct PyWeakProxy {
|
||||
weak: PyWeak,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyWeakProxy {}
|
||||
|
||||
impl PyValue for PyWeakProxy {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.ctx.weakproxy_type()
|
||||
|
||||
@@ -2,7 +2,6 @@ use super::objtype::PyClassRef;
|
||||
use crate::function::{OptionalArg, PyFuncArgs};
|
||||
use crate::pyobject::{
|
||||
PyClassImpl, PyContext, PyObject, PyObjectPayload, PyObjectRef, PyRef, PyResult, PyValue,
|
||||
ThreadSafe,
|
||||
};
|
||||
use crate::slots::SlotCall;
|
||||
use crate::vm::VirtualMachine;
|
||||
@@ -15,8 +14,6 @@ pub struct PyWeak {
|
||||
referent: Weak<PyObject<dyn PyObjectPayload>>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyWeak {}
|
||||
|
||||
impl PyWeak {
|
||||
pub fn downgrade(obj: &PyObjectRef) -> PyWeak {
|
||||
PyWeak {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::objiter;
|
||||
use super::objtype::PyClassRef;
|
||||
use crate::function::Args;
|
||||
use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe};
|
||||
use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
pub type PyZipRef = PyRef<PyZip>;
|
||||
@@ -11,7 +11,6 @@ pub type PyZipRef = PyRef<PyZip>;
|
||||
pub struct PyZip {
|
||||
iterators: Vec<PyObjectRef>,
|
||||
}
|
||||
impl ThreadSafe for PyZip {}
|
||||
|
||||
impl PyValue for PyZip {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
|
||||
@@ -1223,9 +1223,6 @@ pub trait PyValue: fmt::Debug + Send + Sync + Sized + 'static {
|
||||
}
|
||||
}
|
||||
|
||||
// Temporary trait to follow the progress of threading conversion
|
||||
pub trait ThreadSafe: Send + Sync {}
|
||||
|
||||
pub trait PyObjectPayload: Any + fmt::Debug + Send + Sync + 'static {
|
||||
fn as_any(&self) -> &dyn Any;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use crate::obj::objtype::PyClassRef;
|
||||
use crate::obj::{objbool, objiter};
|
||||
use crate::pyobject::{
|
||||
Either, IntoPyObject, PyClassImpl, PyIterable, PyObjectRef, PyRef, PyResult, PyValue,
|
||||
ThreadSafe, TryFromObject,
|
||||
TryFromObject,
|
||||
};
|
||||
use crate::VirtualMachine;
|
||||
|
||||
@@ -228,8 +228,6 @@ pub struct PyArray {
|
||||
array: RwLock<ArrayContentType>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyArray {}
|
||||
|
||||
pub type PyArrayRef = PyRef<PyArray>;
|
||||
|
||||
impl PyValue for PyArray {
|
||||
@@ -435,8 +433,6 @@ pub struct PyArrayIter {
|
||||
array: PyArrayRef,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyArrayIter {}
|
||||
|
||||
impl PyValue for PyArrayIter {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("array", "arrayiterator")
|
||||
|
||||
@@ -6,7 +6,7 @@ mod _collections {
|
||||
use crate::obj::{objiter, objtype::PyClassRef};
|
||||
use crate::pyobject::{
|
||||
IdProtocol, PyArithmaticValue::*, PyClassImpl, PyComparisonValue, PyIterable, PyObjectRef,
|
||||
PyRef, PyResult, PyValue, ThreadSafe,
|
||||
PyRef, PyResult, PyValue,
|
||||
};
|
||||
use crate::sequence;
|
||||
use crate::vm::ReprGuard;
|
||||
@@ -25,8 +25,6 @@ mod _collections {
|
||||
}
|
||||
type PyDequeRef = PyRef<PyDeque>;
|
||||
|
||||
impl ThreadSafe for PyDeque {}
|
||||
|
||||
impl PyValue for PyDeque {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("_collections", "deque")
|
||||
@@ -379,8 +377,6 @@ mod _collections {
|
||||
deque: PyDequeRef,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyDequeIterator {}
|
||||
|
||||
impl PyValue for PyDequeIterator {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("_collections", "_deque_iterator")
|
||||
|
||||
@@ -10,7 +10,7 @@ use crate::obj::objiter;
|
||||
use crate::obj::objstr::{self, PyString};
|
||||
use crate::obj::objtype::PyClassRef;
|
||||
use crate::pyobject::{IntoPyObject, TryFromObject, TypeProtocol};
|
||||
use crate::pyobject::{PyClassImpl, PyIterable, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe};
|
||||
use crate::pyobject::{PyClassImpl, PyIterable, PyObjectRef, PyRef, PyResult, PyValue};
|
||||
use crate::types::create_type;
|
||||
use crate::VirtualMachine;
|
||||
|
||||
@@ -129,8 +129,6 @@ struct Reader {
|
||||
state: RwLock<ReadState>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for Reader {}
|
||||
|
||||
impl Debug for Reader {
|
||||
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
||||
write!(f, "_csv.reader")
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::function::{OptionalArg, PyFuncArgs};
|
||||
use crate::obj::objbytes::{PyBytes, PyBytesRef};
|
||||
use crate::obj::objstr::PyStringRef;
|
||||
use crate::obj::objtype::PyClassRef;
|
||||
use crate::pyobject::{PyClassImpl, PyObjectRef, PyResult, PyValue, ThreadSafe};
|
||||
use crate::pyobject::{PyClassImpl, PyObjectRef, PyResult, PyValue};
|
||||
use crate::vm::VirtualMachine;
|
||||
use std::fmt;
|
||||
use std::sync::{RwLock, RwLockReadGuard, RwLockWriteGuard};
|
||||
@@ -20,8 +20,6 @@ struct PyHasher {
|
||||
buffer: RwLock<HashWrapper>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyHasher {}
|
||||
|
||||
impl fmt::Debug for PyHasher {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "hasher {}", self.name)
|
||||
|
||||
@@ -19,7 +19,7 @@ use crate::obj::objiter;
|
||||
use crate::obj::objstr::{self, PyStringRef};
|
||||
use crate::obj::objtype::{self, PyClassRef};
|
||||
use crate::pyobject::{
|
||||
BufferProtocol, Either, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe, TryFromObject,
|
||||
BufferProtocol, Either, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject,
|
||||
};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
@@ -127,8 +127,6 @@ struct PyStringIO {
|
||||
|
||||
type PyStringIORef = PyRef<PyStringIO>;
|
||||
|
||||
impl ThreadSafe for PyStringIO {}
|
||||
|
||||
impl PyValue for PyStringIO {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("io", "StringIO")
|
||||
@@ -252,8 +250,6 @@ struct PyBytesIO {
|
||||
|
||||
type PyBytesIORef = PyRef<PyBytesIO>;
|
||||
|
||||
impl ThreadSafe for PyBytesIO {}
|
||||
|
||||
impl PyValue for PyBytesIO {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("io", "BytesIO")
|
||||
|
||||
@@ -15,8 +15,7 @@ mod decl {
|
||||
use crate::obj::objtuple::PyTuple;
|
||||
use crate::obj::objtype::{self, PyClassRef};
|
||||
use crate::pyobject::{
|
||||
IdProtocol, PyCallable, PyClassImpl, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe,
|
||||
TypeProtocol,
|
||||
IdProtocol, PyCallable, PyClassImpl, PyObjectRef, PyRef, PyResult, PyValue, TypeProtocol,
|
||||
};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
@@ -28,8 +27,6 @@ mod decl {
|
||||
cached_iter: RwLock<Option<PyObjectRef>>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyItertoolsChain {}
|
||||
|
||||
impl PyValue for PyItertoolsChain {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("itertools", "chain")
|
||||
@@ -114,8 +111,6 @@ mod decl {
|
||||
selector: PyObjectRef,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyItertoolsCompress {}
|
||||
|
||||
impl PyValue for PyItertoolsCompress {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("itertools", "compress")
|
||||
@@ -167,8 +162,6 @@ mod decl {
|
||||
step: BigInt,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyItertoolsCount {}
|
||||
|
||||
impl PyValue for PyItertoolsCount {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("itertools", "count")
|
||||
@@ -222,8 +215,6 @@ mod decl {
|
||||
index: AtomicCell<usize>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyItertoolsCycle {}
|
||||
|
||||
impl PyValue for PyItertoolsCycle {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("itertools", "cycle")
|
||||
@@ -284,8 +275,6 @@ mod decl {
|
||||
times: Option<RwLock<BigInt>>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyItertoolsRepeat {}
|
||||
|
||||
impl PyValue for PyItertoolsRepeat {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("itertools", "repeat")
|
||||
@@ -347,8 +336,6 @@ mod decl {
|
||||
iter: PyObjectRef,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyItertoolsStarmap {}
|
||||
|
||||
impl PyValue for PyItertoolsStarmap {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("itertools", "starmap")
|
||||
@@ -391,8 +378,6 @@ mod decl {
|
||||
stop_flag: AtomicCell<bool>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyItertoolsTakewhile {}
|
||||
|
||||
impl PyValue for PyItertoolsTakewhile {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("itertools", "takewhile")
|
||||
@@ -452,8 +437,6 @@ mod decl {
|
||||
start_flag: AtomicCell<bool>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyItertoolsDropwhile {}
|
||||
|
||||
impl PyValue for PyItertoolsDropwhile {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("itertools", "dropwhile")
|
||||
@@ -514,8 +497,6 @@ mod decl {
|
||||
step: usize,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyItertoolsIslice {}
|
||||
|
||||
impl PyValue for PyItertoolsIslice {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("itertools", "islice")
|
||||
@@ -639,8 +620,6 @@ mod decl {
|
||||
iterable: PyObjectRef,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyItertoolsFilterFalse {}
|
||||
|
||||
impl PyValue for PyItertoolsFilterFalse {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("itertools", "filterfalse")
|
||||
@@ -698,8 +677,6 @@ mod decl {
|
||||
acc_value: RwLock<Option<PyObjectRef>>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyItertoolsAccumulate {}
|
||||
|
||||
impl PyValue for PyItertoolsAccumulate {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("itertools", "accumulate")
|
||||
@@ -759,8 +736,6 @@ mod decl {
|
||||
values: RwLock<Vec<PyObjectRef>>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyItertoolsTeeData {}
|
||||
|
||||
impl PyItertoolsTeeData {
|
||||
fn new(iterable: PyObjectRef, vm: &VirtualMachine) -> PyResult<Arc<PyItertoolsTeeData>> {
|
||||
Ok(Arc::new(PyItertoolsTeeData {
|
||||
@@ -785,8 +760,6 @@ mod decl {
|
||||
index: AtomicCell<usize>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyItertoolsTee {}
|
||||
|
||||
impl PyValue for PyItertoolsTee {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("itertools", "tee")
|
||||
@@ -867,8 +840,6 @@ mod decl {
|
||||
stop: AtomicCell<bool>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyItertoolsProduct {}
|
||||
|
||||
impl PyValue for PyItertoolsProduct {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("itertools", "product")
|
||||
@@ -981,8 +952,6 @@ mod decl {
|
||||
exhausted: AtomicCell<bool>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyItertoolsCombinations {}
|
||||
|
||||
impl PyValue for PyItertoolsCombinations {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("itertools", "combinations")
|
||||
@@ -1083,8 +1052,6 @@ mod decl {
|
||||
exhausted: AtomicCell<bool>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyItertoolsCombinationsWithReplacement {}
|
||||
|
||||
impl PyValue for PyItertoolsCombinationsWithReplacement {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("itertools", "combinations_with_replacement")
|
||||
@@ -1181,8 +1148,6 @@ mod decl {
|
||||
exhausted: AtomicCell<bool>, // Set when the iterator is exhausted
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyItertoolsPermutations {}
|
||||
|
||||
impl PyValue for PyItertoolsPermutations {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("itertools", "permutations")
|
||||
@@ -1309,8 +1274,6 @@ mod decl {
|
||||
fillvalue: PyObjectRef,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyItertoolsZipLongest {}
|
||||
|
||||
impl PyValue for PyItertoolsZipLongest {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("itertools", "zip_longest")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::obj::objiter;
|
||||
use crate::obj::objstr::PyStringRef;
|
||||
use crate::obj::{objbool, objtype::PyClassRef};
|
||||
use crate::pyobject::{IdProtocol, PyClassImpl, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe};
|
||||
use crate::pyobject::{IdProtocol, PyClassImpl, PyObjectRef, PyRef, PyResult, PyValue};
|
||||
use crate::VirtualMachine;
|
||||
|
||||
use num_bigint::BigInt;
|
||||
@@ -19,8 +19,6 @@ struct JsonScanner {
|
||||
ctx: PyObjectRef,
|
||||
}
|
||||
|
||||
impl ThreadSafe for JsonScanner {}
|
||||
|
||||
impl PyValue for JsonScanner {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("_json", "make_scanner")
|
||||
|
||||
@@ -36,8 +36,8 @@ use crate::obj::objstr::{PyString, PyStringRef};
|
||||
use crate::obj::objtuple::PyTupleRef;
|
||||
use crate::obj::objtype::PyClassRef;
|
||||
use crate::pyobject::{
|
||||
Either, ItemProtocol, PyClassImpl, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe,
|
||||
TryFromObject, TypeProtocol,
|
||||
Either, ItemProtocol, PyClassImpl, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject,
|
||||
TypeProtocol,
|
||||
};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
@@ -598,8 +598,6 @@ struct DirEntry {
|
||||
mode: OutputMode,
|
||||
}
|
||||
|
||||
impl ThreadSafe for DirEntry {}
|
||||
|
||||
type DirEntryRef = PyRef<DirEntry>;
|
||||
|
||||
impl PyValue for DirEntry {
|
||||
@@ -691,8 +689,6 @@ struct ScandirIterator {
|
||||
mode: OutputMode,
|
||||
}
|
||||
|
||||
impl ThreadSafe for ScandirIterator {}
|
||||
|
||||
impl PyValue for ScandirIterator {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class(MODULE_NAME, "ScandirIter")
|
||||
|
||||
@@ -27,7 +27,7 @@ mod _struct {
|
||||
objtuple::PyTuple, objtype::PyClassRef,
|
||||
};
|
||||
use crate::pyobject::{
|
||||
Either, PyClassImpl, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe, TryFromObject,
|
||||
Either, PyClassImpl, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject,
|
||||
};
|
||||
use crate::VirtualMachine;
|
||||
|
||||
@@ -679,8 +679,6 @@ mod _struct {
|
||||
fmt_str: PyStringRef,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyStruct {}
|
||||
|
||||
impl PyValue for PyStruct {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("_struct", "Struct")
|
||||
|
||||
@@ -7,7 +7,7 @@ mod _random {
|
||||
use crate::function::OptionalOption;
|
||||
use crate::obj::objint::PyIntRef;
|
||||
use crate::obj::objtype::PyClassRef;
|
||||
use crate::pyobject::{PyClassImpl, PyRef, PyResult, PyValue, ThreadSafe};
|
||||
use crate::pyobject::{PyClassImpl, PyRef, PyResult, PyValue};
|
||||
use crate::VirtualMachine;
|
||||
use generational_arena::{self, Arena};
|
||||
use num_bigint::{BigInt, Sign};
|
||||
@@ -97,8 +97,6 @@ mod _random {
|
||||
rng: RngHandle,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyRandom {}
|
||||
|
||||
impl PyValue for PyRandom {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("_random", "Random")
|
||||
|
||||
@@ -13,7 +13,7 @@ use crate::function::{Args, OptionalArg};
|
||||
use crate::obj::objint::{PyInt, PyIntRef};
|
||||
use crate::obj::objstr::{PyString, PyStringRef};
|
||||
use crate::obj::objtype::PyClassRef;
|
||||
use crate::pyobject::{PyClassImpl, PyObjectRef, PyResult, PyValue, ThreadSafe, TryFromObject};
|
||||
use crate::pyobject::{PyClassImpl, PyObjectRef, PyResult, PyValue, TryFromObject};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
#[pyclass(name = "Pattern")]
|
||||
@@ -23,8 +23,6 @@ struct PyPattern {
|
||||
pattern: String,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyPattern {}
|
||||
|
||||
const IGNORECASE: usize = 2;
|
||||
const LOCALE: usize = 4;
|
||||
const MULTILINE: usize = 8;
|
||||
@@ -77,8 +75,6 @@ struct PyMatch {
|
||||
captures: Vec<Option<(usize, usize)>>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyMatch {}
|
||||
|
||||
impl fmt::Debug for PyMatch {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "Match()")
|
||||
|
||||
@@ -22,8 +22,7 @@ use crate::obj::objstr::{PyString, PyStringRef};
|
||||
use crate::obj::objtuple::PyTupleRef;
|
||||
use crate::obj::objtype::PyClassRef;
|
||||
use crate::pyobject::{
|
||||
Either, IntoPyObject, PyClassImpl, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe,
|
||||
TryFromObject,
|
||||
Either, IntoPyObject, PyClassImpl, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject,
|
||||
};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
@@ -52,8 +51,6 @@ pub struct PySocket {
|
||||
sock: RwLock<Socket>,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PySocket {}
|
||||
|
||||
impl PyValue for PySocket {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("_socket", "socket")
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::obj::objbytes::PyBytesRef;
|
||||
use crate::obj::objlist::PyListRef;
|
||||
use crate::obj::objstr::{self, PyStringRef};
|
||||
use crate::obj::objtype::PyClassRef;
|
||||
use crate::pyobject::{Either, IntoPyObject, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe};
|
||||
use crate::pyobject::{Either, IntoPyObject, PyObjectRef, PyRef, PyResult, PyValue};
|
||||
use crate::stdlib::io::io_open;
|
||||
use crate::stdlib::os::{convert_io_error, raw_file_number, rust_file};
|
||||
use crate::vm::VirtualMachine;
|
||||
@@ -24,8 +24,6 @@ struct Popen {
|
||||
#[cfg(windows)]
|
||||
unsafe impl Sync for Popen {}
|
||||
|
||||
impl ThreadSafe for Popen {}
|
||||
|
||||
impl PyValue for Popen {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("_subprocess", "Popen")
|
||||
|
||||
@@ -5,7 +5,7 @@ use rustpython_parser::parser;
|
||||
|
||||
use crate::obj::objstr::PyStringRef;
|
||||
use crate::obj::objtype::PyClassRef;
|
||||
use crate::pyobject::{PyClassImpl, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe};
|
||||
use crate::pyobject::{PyClassImpl, PyObjectRef, PyRef, PyResult, PyValue};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
|
||||
@@ -72,8 +72,6 @@ struct PySymbolTable {
|
||||
symtable: symboltable::SymbolTable,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PySymbolTable {}
|
||||
|
||||
impl fmt::Debug for PySymbolTable {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "SymbolTable()")
|
||||
@@ -160,8 +158,6 @@ struct PySymbol {
|
||||
symbol: symboltable::Symbol,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PySymbol {}
|
||||
|
||||
impl fmt::Debug for PySymbol {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "Symbol()")
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
use crate::function::OptionalArg;
|
||||
use crate::obj::objstr::PyStringRef;
|
||||
use crate::obj::objtype::PyClassRef;
|
||||
use crate::pyobject::{PyClassImpl, PyObject, PyObjectRef, PyResult, PyValue, ThreadSafe};
|
||||
use crate::pyobject::{PyClassImpl, PyObject, PyObjectRef, PyResult, PyValue};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
use itertools::Itertools;
|
||||
@@ -60,8 +60,6 @@ struct PyUCD {
|
||||
unic_version: UnicodeVersion,
|
||||
}
|
||||
|
||||
impl ThreadSafe for PyUCD {}
|
||||
|
||||
impl PyValue for PyUCD {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("unicodedata", "UCD")
|
||||
|
||||
@@ -7,9 +7,7 @@ use super::os;
|
||||
use crate::function::OptionalArg;
|
||||
use crate::obj::objstr::PyStringRef;
|
||||
use crate::obj::objtype::PyClassRef;
|
||||
use crate::pyobject::{
|
||||
PyClassImpl, PyObjectRef, PyRef, PyResult, PyValue, ThreadSafe, TryFromObject,
|
||||
};
|
||||
use crate::pyobject::{PyClassImpl, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject};
|
||||
use crate::VirtualMachine;
|
||||
|
||||
use winapi::shared::winerror;
|
||||
@@ -25,8 +23,6 @@ type PyHKEYRef = PyRef<PyHKEY>;
|
||||
// TODO: fix this
|
||||
unsafe impl Sync for PyHKEY {}
|
||||
|
||||
impl ThreadSafe for PyHKEY {}
|
||||
|
||||
impl PyValue for PyHKEY {
|
||||
fn class(vm: &VirtualMachine) -> PyClassRef {
|
||||
vm.class("winreg", "HKEYType")
|
||||
|
||||
Reference in New Issue
Block a user