mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
move ToPy* to convert
This commit is contained in:
1 parent
a07fcd2b44
commit
e356d51af1
70 files changed
+165
-145
No files matched your search
@@ -29,14 +29,14 @@ pub(crate) fn impl_pystruct_sequence(input: DeriveInput) -> Result<TokenStream>
|
||||
impl ::rustpython_vm::PyStructSequence for #ty {
|
||||
const FIELD_NAMES: &'static [&'static str] = &[#(stringify!(#field_names)),*];
|
||||
fn into_tuple(self, vm: &::rustpython_vm::VirtualMachine) -> ::rustpython_vm::builtins::PyTuple {
|
||||
let items = vec![#(::rustpython_vm::function::ToPyObject::to_pyobject(
|
||||
let items = vec![#(::rustpython_vm::convert::ToPyObject::to_pyobject(
|
||||
self.#field_names,
|
||||
vm,
|
||||
)),*];
|
||||
::rustpython_vm::builtins::PyTuple::new_unchecked(items.into_boxed_slice())
|
||||
}
|
||||
}
|
||||
impl ::rustpython_vm::function::ToPyObject for #ty {
|
||||
impl ::rustpython_vm::convert::ToPyObject for #ty {
|
||||
fn to_pyobject(self, vm: &::rustpython_vm::VirtualMachine) -> ::rustpython_vm::PyObjectRef {
|
||||
::rustpython_vm::PyStructSequence::into_struct_sequence(self, vm).into()
|
||||
}
|
||||
|
||||
+3
-5
@@ -17,10 +17,8 @@ mod array {
|
||||
PyListRef, PyStr, PyStrRef, PyTupleRef, PyTypeRef,
|
||||
},
|
||||
class_or_notimplemented,
|
||||
function::{
|
||||
ArgBytesLike, ArgIntoFloat, ArgIterable, OptionalArg, PyComparisonValue,
|
||||
ToPyObject, ToPyResult,
|
||||
},
|
||||
convert::{ToPyObject, ToPyResult, TryFromBorrowedObject, TryFromObject},
|
||||
function::{ArgBytesLike, ArgIntoFloat, ArgIterable, OptionalArg, PyComparisonValue},
|
||||
protocol::{
|
||||
BufferDescriptor, BufferMethods, BufferResizeGuard, PyBuffer, PyIterReturn,
|
||||
PyMappingMethods,
|
||||
@@ -34,7 +32,7 @@ mod array {
|
||||
PyComparisonOp,
|
||||
},
|
||||
AsPyObject, PyObject, PyObjectRef, PyObjectView, PyRef, PyResult, PyValue,
|
||||
TryFromBorrowedObject, TryFromObject, VirtualMachine,
|
||||
VirtualMachine,
|
||||
},
|
||||
};
|
||||
use itertools::Itertools;
|
||||
|
||||
+2
-1
@@ -6,7 +6,8 @@ mod _json {
|
||||
use super::machinery;
|
||||
use crate::vm::{
|
||||
builtins::{PyBaseExceptionRef, PyStrRef, PyTypeRef},
|
||||
function::{OptionalArg, ToPyObject, ToPyResult},
|
||||
convert::{ToPyObject, ToPyResult},
|
||||
function::OptionalArg,
|
||||
protocol::PyIterReturn,
|
||||
types::{Callable, Constructor},
|
||||
AsPyObject, PyObjectRef, PyObjectView, PyResult, PyValue, VirtualMachine,
|
||||
|
||||
@@ -19,7 +19,7 @@ pub(crate) use _posixsubprocess::make_module;
|
||||
#[pymodule]
|
||||
mod _posixsubprocess {
|
||||
use super::{exec, CStrPathLike, ForkExecArgs, ProcArgs};
|
||||
use crate::vm::{function::ToPyException, PyResult, VirtualMachine};
|
||||
use crate::vm::{convert::ToPyException, PyResult, VirtualMachine};
|
||||
|
||||
#[pyfunction]
|
||||
fn fork_exec(args: ForkExecArgs, vm: &VirtualMachine) -> PyResult<libc::pid_t> {
|
||||
|
||||
+16
-11
@@ -10,8 +10,9 @@ mod re {
|
||||
*/
|
||||
use crate::vm::{
|
||||
builtins::{PyInt, PyIntRef, PyStr, PyStrRef},
|
||||
function::{ToPyObject, OptionalArg, PosArgs},
|
||||
match_class, PyObjectRef, PyResult, PyValue, TryFromObject, VirtualMachine,
|
||||
convert::{ToPyObject, TryFromObject},
|
||||
function::{OptionalArg, PosArgs},
|
||||
match_class, PyObjectRef, PyResult, PyValue, VirtualMachine,
|
||||
};
|
||||
use num_traits::Signed;
|
||||
use regex::bytes::{Captures, Regex, RegexBuilder};
|
||||
@@ -252,9 +253,11 @@ mod re {
|
||||
let split = output
|
||||
.into_iter()
|
||||
.map(|v| {
|
||||
vm.unwrap_or_none(
|
||||
v.map(|v| vm.ctx.new_str(String::from_utf8_lossy(v).into_owned()).into()),
|
||||
)
|
||||
vm.unwrap_or_none(v.map(|v| {
|
||||
vm.ctx
|
||||
.new_str(String::from_utf8_lossy(v).into_owned())
|
||||
.into()
|
||||
}))
|
||||
})
|
||||
.collect();
|
||||
Ok(vm.ctx.new_list(split).into())
|
||||
@@ -369,18 +372,20 @@ mod re {
|
||||
#[pymethod]
|
||||
fn start(&self, group: OptionalArg, vm: &VirtualMachine) -> PyResult {
|
||||
let group = group.unwrap_or_else(|| vm.ctx.new_int(0).into());
|
||||
let start = self
|
||||
.get_bounds(group, vm)?
|
||||
.map_or_else(|| vm.ctx.new_int(-1).into(), |r| vm.ctx.new_int(r.start).into());
|
||||
let start = self.get_bounds(group, vm)?.map_or_else(
|
||||
|| vm.ctx.new_int(-1).into(),
|
||||
|r| vm.ctx.new_int(r.start).into(),
|
||||
);
|
||||
Ok(start)
|
||||
}
|
||||
|
||||
#[pymethod]
|
||||
fn end(&self, group: OptionalArg, vm: &VirtualMachine) -> PyResult {
|
||||
let group = group.unwrap_or_else(|| vm.ctx.new_int(0).into());
|
||||
let end = self
|
||||
.get_bounds(group, vm)?
|
||||
.map_or_else(|| vm.ctx.new_int(-1).into(), |r| vm.ctx.new_int(r.end).into());
|
||||
let end = self.get_bounds(group, vm)?.map_or_else(
|
||||
|| vm.ctx.new_int(-1).into(),
|
||||
|r| vm.ctx.new_int(r.end).into(),
|
||||
);
|
||||
Ok(end)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ pub(crate) use resource::make_module;
|
||||
#[pymodule]
|
||||
mod resource {
|
||||
use crate::vm::{
|
||||
function::{ToPyException, ToPyObject},
|
||||
convert::{ToPyException, ToPyObject},
|
||||
stdlib::os,
|
||||
PyObject, PyObjectRef, PyResult, PyStructSequence, TryFromBorrowedObject, VirtualMachine,
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ mod _scproxy {
|
||||
|
||||
use crate::vm::{
|
||||
builtins::{PyDictRef, PyStr},
|
||||
function::ToPyObject,
|
||||
convert::ToPyObject,
|
||||
PyResult, VirtualMachine,
|
||||
};
|
||||
use system_configuration::core_foundation::{
|
||||
|
||||
+5
-10
@@ -154,12 +154,10 @@ fn sec_to_timeval(sec: f64) -> timeval {
|
||||
mod decl {
|
||||
use super::*;
|
||||
use crate::vm::{
|
||||
builtins::PyTypeRef,
|
||||
function::{OptionalOption, ToPyException},
|
||||
stdlib::time,
|
||||
utils::Either,
|
||||
PyObjectRef, PyResult, VirtualMachine,
|
||||
builtins::PyTypeRef, convert::ToPyException, function::OptionalOption, stdlib::time,
|
||||
utils::Either, PyObjectRef, PyResult, VirtualMachine,
|
||||
};
|
||||
|
||||
#[pyattr]
|
||||
fn error(vm: &VirtualMachine) -> PyTypeRef {
|
||||
vm.ctx.exceptions.os_error.clone()
|
||||
@@ -262,11 +260,8 @@ mod decl {
|
||||
pub(super) mod poll {
|
||||
use super::*;
|
||||
use crate::vm::{
|
||||
builtins::PyFloat,
|
||||
common::lock::PyMutex,
|
||||
function::{OptionalArg, ToPyObject},
|
||||
stdlib::io::Fildes,
|
||||
AsPyObject, PyValue,
|
||||
builtins::PyFloat, common::lock::PyMutex, convert::ToPyObject, function::OptionalArg,
|
||||
stdlib::io::Fildes, AsPyObject, PyValue,
|
||||
};
|
||||
use libc::pollfd;
|
||||
use num_traits::ToPrimitive;
|
||||
|
||||
@@ -13,13 +13,10 @@ mod _socket {
|
||||
use crate::common::lock::{PyMappedRwLockReadGuard, PyRwLock, PyRwLockReadGuard};
|
||||
use crate::vm::{
|
||||
builtins::{PyBaseExceptionRef, PyListRef, PyStrRef, PyTupleRef, PyTypeRef},
|
||||
function::{
|
||||
ArgBytesLike, ArgMemoryBuffer, FuncArgs, OptionalArg, OptionalOption, ToPyException,
|
||||
ToPyObject,
|
||||
},
|
||||
convert::{ToPyException, ToPyObject, TryFromBorrowedObject, TryFromObject},
|
||||
function::{ArgBytesLike, ArgMemoryBuffer, FuncArgs, OptionalArg, OptionalOption},
|
||||
utils::{Either, ToCString},
|
||||
AsPyObject, PyObjectRef, PyResult, PyValue, TryFromBorrowedObject, TryFromObject,
|
||||
VirtualMachine,
|
||||
AsPyObject, PyObjectRef, PyResult, PyValue, VirtualMachine,
|
||||
};
|
||||
use crossbeam_utils::atomic::AtomicCell;
|
||||
use num_traits::ToPrimitive;
|
||||
|
||||
+2
-2
@@ -31,10 +31,10 @@ mod _ssl {
|
||||
socket::{self, PySocket},
|
||||
vm::{
|
||||
builtins::{PyBaseExceptionRef, PyStrRef, PyType, PyTypeRef},
|
||||
convert::{ToPyException, ToPyObject},
|
||||
exceptions,
|
||||
function::{
|
||||
ArgBytesLike, ArgCallable, ArgMemoryBuffer, ArgStrOrBytesLike, OptionalArg,
|
||||
ToPyException, ToPyObject,
|
||||
},
|
||||
stdlib::os::PyPathLike,
|
||||
types::Constructor,
|
||||
@@ -1399,7 +1399,7 @@ mod windows {
|
||||
common::ascii,
|
||||
vm::{
|
||||
builtins::{PyFrozenSet, PyStrRef},
|
||||
function::ToPyException,
|
||||
convert::ToPyException,
|
||||
PyObjectRef, PyResult, PyValue, VirtualMachine,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@ pub(crate) use self::termios::make_module;
|
||||
mod termios {
|
||||
use crate::vm::{
|
||||
builtins::{PyBaseExceptionRef, PyBytes, PyInt, PyListRef, PyTypeRef},
|
||||
function::ToPyObject,
|
||||
convert::ToPyObject,
|
||||
PyObjectRef, PyResult, TryFromObject, VirtualMachine,
|
||||
};
|
||||
use termios::Termios;
|
||||
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
use crate::{
|
||||
builtins::{float, PyBaseExceptionRef, PyBytesRef, PyTuple, PyTupleRef, PyTypeRef},
|
||||
common::{static_cell, str::wchar_t},
|
||||
function::{ArgBytesLike, ArgIntoBool, ToPyObject},
|
||||
convert::ToPyObject,
|
||||
function::{ArgBytesLike, ArgIntoBool},
|
||||
PyObjectRef, PyResult, TryFromObject, VirtualMachine,
|
||||
};
|
||||
use half::f16;
|
||||
|
||||
@@ -18,9 +18,9 @@ use crate::{
|
||||
PyRwLockReadGuard, PyRwLockWriteGuard,
|
||||
},
|
||||
},
|
||||
convert::ToPyObject,
|
||||
function::{
|
||||
ArgBytesLike, ArgIterable, FuncArgs, OptionalArg, OptionalOption, PyComparisonValue,
|
||||
ToPyObject,
|
||||
},
|
||||
protocol::{
|
||||
BufferDescriptor, BufferMethods, BufferResizeGuard, PyBuffer, PyIterReturn,
|
||||
|
||||
@@ -7,10 +7,8 @@ use crate::{
|
||||
ByteInnerSplitOptions, ByteInnerTranslateOptions, DecodeArgs, PyBytesInner,
|
||||
},
|
||||
common::{hash::PyHash, lock::PyMutex},
|
||||
function::{
|
||||
ArgBytesLike, ArgIterable, OptionalArg, OptionalOption, PyComparisonValue, ToPyObject,
|
||||
ToPyResult,
|
||||
},
|
||||
convert::{ToPyObject, ToPyResult},
|
||||
function::{ArgBytesLike, ArgIterable, OptionalArg, OptionalOption, PyComparisonValue},
|
||||
protocol::{
|
||||
BufferDescriptor, BufferMethods, PyBuffer, PyIterReturn, PyMappingMethods,
|
||||
PySequenceMethods,
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
use super::{float, PyStr, PyTypeRef};
|
||||
use crate::{
|
||||
convert::ToPyObject,
|
||||
function::{
|
||||
OptionalArg, OptionalOption,
|
||||
PyArithmeticValue::{self, *},
|
||||
PyComparisonValue, ToPyObject,
|
||||
PyComparisonValue,
|
||||
},
|
||||
pyclass::PyClassImpl,
|
||||
types::{Comparable, Constructor, Hashable, PyComparisonOp},
|
||||
|
||||
@@ -9,10 +9,10 @@ use crate::{
|
||||
PyTuple,
|
||||
},
|
||||
common::ascii,
|
||||
convert::ToPyObject,
|
||||
dictdatatype::{self, DictKey},
|
||||
function::{
|
||||
ArgIterable, FuncArgs, KwArgs, OptionalArg, PyArithmeticValue::*, PyComparisonValue,
|
||||
ToPyObject,
|
||||
},
|
||||
protocol::{PyIterIter, PyIterReturn, PyMappingMethods, PySequenceMethods},
|
||||
pyclass::{PyClassDef, PyClassImpl},
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use super::{IterStatus, PositionIterInternal, PyGenericAlias, PyIntRef, PyTupleRef, PyTypeRef};
|
||||
use crate::common::lock::{PyMutex, PyRwLock};
|
||||
use crate::{
|
||||
function::{OptionalArg, ToPyObject},
|
||||
convert::ToPyObject,
|
||||
function::OptionalArg,
|
||||
protocol::{PyIter, PyIterReturn},
|
||||
pyclass::PyClassImpl,
|
||||
types::{Constructor, IterNext, IterNextIterable},
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
use super::{try_bigint_to_f64, PyByteArray, PyBytes, PyInt, PyIntRef, PyStr, PyStrRef, PyTypeRef};
|
||||
use crate::common::{float_ops, hash};
|
||||
use crate::{
|
||||
convert::ToPyObject,
|
||||
format::FormatSpec,
|
||||
function::{
|
||||
ArgBytesLike, OptionalArg, OptionalOption,
|
||||
PyArithmeticValue::{self, *},
|
||||
PyComparisonValue, ToPyObject,
|
||||
PyComparisonValue,
|
||||
},
|
||||
pyclass::PyClassImpl,
|
||||
types::{Comparable, Constructor, Hashable, PyComparisonOp},
|
||||
|
||||
@@ -17,7 +17,7 @@ use crate::{
|
||||
AsPyObject, PyContext, PyObject, PyObjectRef, PyRef, PyResult, PyValue, VirtualMachine,
|
||||
};
|
||||
#[cfg(feature = "jit")]
|
||||
use crate::{common::lock::OnceCell, function::ToPyObject};
|
||||
use crate::{common::lock::OnceCell, convert::ToPyObject};
|
||||
use itertools::Itertools;
|
||||
#[cfg(feature = "jit")]
|
||||
use rustpython_jit::CompiledCode;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use crate::{
|
||||
builtins::{float, int, pybool, PyBaseExceptionRef, PyDictRef, PyFunction, PyStrRef},
|
||||
bytecode::CodeFlags,
|
||||
function::{FuncArgs, ToPyObject},
|
||||
convert::ToPyObject,
|
||||
function::FuncArgs,
|
||||
AsPyObject, PyObject, PyObjectRef, PyResult, TryFromObject, VirtualMachine,
|
||||
};
|
||||
use num_traits::ToPrimitive;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use crate::{
|
||||
builtins::{PyList, PyStr, PyStrRef, PyTuple, PyTupleRef, PyType, PyTypeRef},
|
||||
common::hash,
|
||||
function::{FuncArgs, PyComparisonValue, ToPyObject},
|
||||
convert::ToPyObject,
|
||||
function::{FuncArgs, PyComparisonValue},
|
||||
protocol::PyMappingMethods,
|
||||
pyclass::PyClassImpl,
|
||||
types::{AsMapping, Callable, Comparable, Constructor, GetAttr, Hashable, PyComparisonOp},
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
*/
|
||||
use super::PyTypeRef;
|
||||
use crate::{
|
||||
function::{OwnedParam, RefParam, ToPyResult},
|
||||
convert::ToPyResult,
|
||||
function::{OwnedParam, RefParam},
|
||||
pyclass::PyClassImpl,
|
||||
pyobject::PyThreadingConstraint,
|
||||
types::{Constructor, GetDescriptor, Unconstructible},
|
||||
|
||||
@@ -2,11 +2,9 @@ use super::{float, PyByteArray, PyBytes, PyStr, PyStrRef, PyTypeRef};
|
||||
use crate::{
|
||||
bytesinner::PyBytesInner,
|
||||
common::hash,
|
||||
convert::{ToPyObject, ToPyResult},
|
||||
format::FormatSpec,
|
||||
function::{
|
||||
ArgIntoBool, OptionalArg, OptionalOption, PyArithmeticValue, PyComparisonValue, ToPyObject,
|
||||
ToPyResult,
|
||||
},
|
||||
function::{ArgIntoBool, OptionalArg, OptionalOption, PyArithmeticValue, PyComparisonValue},
|
||||
pyclass::PyClassImpl,
|
||||
types::{Comparable, Constructor, Hashable, PyComparisonOp},
|
||||
AsPyObject, PyContext, PyObject, PyObjectRef, PyRef, PyResult, PyValue, TryFromBorrowedObject,
|
||||
|
||||
@@ -4,7 +4,8 @@ use crate::common::lock::{
|
||||
};
|
||||
use crate::TryFromBorrowedObject;
|
||||
use crate::{
|
||||
function::{FuncArgs, OptionalArg, PyComparisonValue, ToPyObject},
|
||||
convert::ToPyObject,
|
||||
function::{FuncArgs, OptionalArg, PyComparisonValue},
|
||||
protocol::{PyIterReturn, PyMappingMethods, PySequence, PySequenceMethods},
|
||||
pyclass::PyClassImpl,
|
||||
sequence::{MutObjectSequenceOp, ObjectSequenceOp, SequenceMutOp, SequenceOp},
|
||||
|
||||
@@ -2,7 +2,8 @@ use std::borrow::Cow;
|
||||
|
||||
use super::{PyDict, PyGenericAlias, PyList, PyStr, PyStrRef, PyTuple, PyTypeRef};
|
||||
use crate::{
|
||||
function::{OptionalArg, ToPyObject},
|
||||
convert::ToPyObject,
|
||||
function::OptionalArg,
|
||||
protocol::{PyMapping, PyMappingMethods, PySequence, PySequenceMethods},
|
||||
pyclass::PyClassImpl,
|
||||
types::{AsMapping, AsSequence, Constructor, Iterable},
|
||||
|
||||
@@ -9,7 +9,8 @@ use crate::{
|
||||
hash::PyHash,
|
||||
lock::OnceCell,
|
||||
},
|
||||
function::{FuncArgs, OptionalArg, PyComparisonValue, ToPyObject},
|
||||
convert::ToPyObject,
|
||||
function::{FuncArgs, OptionalArg, PyComparisonValue},
|
||||
protocol::{
|
||||
BufferDescriptor, BufferMethods, PyBuffer, PyMappingMethods, PySequenceMethods, VecBuffer,
|
||||
},
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
use super::pystr::IntoPyStrRef;
|
||||
use super::{PyDictRef, PyStr, PyStrRef, PyTypeRef};
|
||||
use crate::{
|
||||
function::{FuncArgs, ToPyObject},
|
||||
pyclass::PyClassImpl,
|
||||
types::GetAttr,
|
||||
AsPyObject, PyContext, PyObjectRef, PyObjectView, PyRef, PyResult, PyValue, VirtualMachine,
|
||||
convert::ToPyObject, function::FuncArgs, pyclass::PyClassImpl, types::GetAttr, AsPyObject,
|
||||
PyContext, PyObjectRef, PyObjectView, PyRef, PyResult, PyValue, VirtualMachine,
|
||||
};
|
||||
|
||||
#[pyclass(module = false, name = "module")]
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
use super::{PyInt, PyStrRef, PyTypeRef};
|
||||
use crate::{
|
||||
function::{OptionalArg, ToPyObject},
|
||||
pyclass::PyClassImpl,
|
||||
types::Constructor,
|
||||
convert::ToPyObject, function::OptionalArg, pyclass::PyClassImpl, types::Constructor,
|
||||
AsPyObject, PyContext, PyObject, PyObjectRef, PyResult, PyValue, TryFromBorrowedObject,
|
||||
VirtualMachine,
|
||||
};
|
||||
|
||||
@@ -5,11 +5,9 @@ use super::{
|
||||
};
|
||||
use crate::{
|
||||
anystr::{self, adjust_indices, AnyStr, AnyStrContainer, AnyStrWrapper},
|
||||
convert::{ToPyException, ToPyObject},
|
||||
format::{FormatSpec, FormatString, FromTemplate},
|
||||
function::{
|
||||
ArgIterable, FuncArgs, OptionalArg, OptionalOption, PyComparisonValue, ToPyException,
|
||||
ToPyObject,
|
||||
},
|
||||
function::{ArgIterable, FuncArgs, OptionalArg, OptionalOption, PyComparisonValue},
|
||||
protocol::{PyIterReturn, PyMappingMethods, PySequenceMethods},
|
||||
pyclass::PyClassImpl,
|
||||
sequence::SequenceOp,
|
||||
|
||||
@@ -2,7 +2,8 @@ use super::genericalias;
|
||||
use crate::{
|
||||
builtins::{PyFrozenSet, PyStr, PyStrRef, PyTuple, PyTupleRef, PyTypeRef},
|
||||
common::hash,
|
||||
function::{PyComparisonValue, ToPyObject},
|
||||
convert::ToPyObject,
|
||||
function::PyComparisonValue,
|
||||
protocol::PyMappingMethods,
|
||||
pyclass::PyClassImpl,
|
||||
types::{AsMapping, Comparable, GetAttr, Hashable, Iterable, PyComparisonOp},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use super::PyTypeRef;
|
||||
use crate::{
|
||||
function::ToPyObject, pyclass::PyClassImpl, types::Constructor, AsPyObject, PyContext,
|
||||
convert::ToPyObject, pyclass::PyClassImpl, types::Constructor, AsPyObject, PyContext,
|
||||
PyObjectRef, PyResult, PyValue, VirtualMachine,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// sliceobject.{h,c} in CPython
|
||||
use super::{PyInt, PyIntRef, PyTupleRef, PyTypeRef};
|
||||
use crate::{
|
||||
function::{FuncArgs, OptionalArg, PyComparisonValue, ToPyObject},
|
||||
convert::ToPyObject,
|
||||
function::{FuncArgs, OptionalArg, PyComparisonValue},
|
||||
pyclass::PyClassImpl,
|
||||
types::{Comparable, Constructor, Hashable, PyComparisonOp, Unhashable},
|
||||
AsPyObject, PyContext, PyObject, PyObjectRef, PyRef, PyResult, PyValue, VirtualMachine,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use super::{PositionIterInternal, PyGenericAlias, PyTypeRef};
|
||||
use crate::common::{hash::PyHash, lock::PyMutex};
|
||||
use crate::{
|
||||
convert::{TransmuteFromObject, TryFromBorrowedObject},
|
||||
function::{OptionalArg, PyArithmeticValue, PyComparisonValue, ToPyObject},
|
||||
convert::{ToPyObject, TransmuteFromObject, TryFromBorrowedObject},
|
||||
function::{OptionalArg, PyArithmeticValue, PyComparisonValue},
|
||||
protocol::{PyIterReturn, PyMappingMethods, PySequenceMethods},
|
||||
pyclass::PyClassImpl,
|
||||
sequence::{ObjectSequenceOp, SequenceOp},
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
builtins::{PyBaseExceptionRef, PyBytesRef, PyStr, PyStrRef, PyTuple, PyTupleRef},
|
||||
common::{ascii, lock::PyRwLock},
|
||||
function::ToPyObject,
|
||||
convert::ToPyObject,
|
||||
AsPyObject, PyContext, PyObject, PyObjectRef, PyResult, PyValue, TryFromObject, VirtualMachine,
|
||||
};
|
||||
use std::{borrow::Cow, collections::HashMap, fmt::Write, ops::Range};
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
mod to_pyobject;
|
||||
mod transmute_from;
|
||||
mod try_from;
|
||||
|
||||
pub use to_pyobject::{ToPyException, ToPyObject, ToPyResult};
|
||||
pub use transmute_from::TransmuteFromObject;
|
||||
pub use try_from::{TryFromBorrowedObject, TryFromObject};
|
||||
pub use try_from::{TryFromBorrowedObject, TryFromObject};
|
||||
@@ -0,0 +1,18 @@
|
||||
use crate::{builtins::PyBaseExceptionRef, PyObjectRef, PyResult, VirtualMachine};
|
||||
|
||||
/// Implemented by any type that can be returned from a built-in Python function.
|
||||
///
|
||||
/// `ToPyObject` has a blanket implementation for any built-in object payload,
|
||||
/// and should be implemented by many primitive Rust types, allowing a built-in
|
||||
/// function to simply return a `bool` or a `usize` for example.
|
||||
pub trait ToPyObject {
|
||||
fn to_pyobject(self, vm: &VirtualMachine) -> PyObjectRef;
|
||||
}
|
||||
|
||||
pub trait ToPyResult {
|
||||
fn to_pyresult(self, vm: &VirtualMachine) -> PyResult;
|
||||
}
|
||||
|
||||
pub trait ToPyException {
|
||||
fn to_pyexception(self, vm: &VirtualMachine) -> PyBaseExceptionRef;
|
||||
}
|
||||
@@ -9,7 +9,7 @@ use crate::common::{
|
||||
};
|
||||
use crate::{
|
||||
builtins::{PyInt, PyStr, PyStrRef},
|
||||
function::ToPyObject,
|
||||
convert::ToPyObject,
|
||||
AsPyObject, PyObject, PyObjectRef, PyRefExact, PyResult, VirtualMachine,
|
||||
};
|
||||
use num_traits::ToPrimitive;
|
||||
|
||||
@@ -4,7 +4,8 @@ use crate::{
|
||||
builtins::{
|
||||
traceback::PyTracebackRef, PyNone, PyStr, PyStrRef, PyTuple, PyTupleRef, PyType, PyTypeRef,
|
||||
},
|
||||
function::{ArgIterable, FuncArgs, ToPyException, ToPyObject},
|
||||
convert::{ToPyException, ToPyObject},
|
||||
function::{ArgIterable, FuncArgs},
|
||||
py_io::{self, Write},
|
||||
pyclass::{PyClassImpl, StaticType},
|
||||
stdlib::sys,
|
||||
@@ -1027,7 +1028,8 @@ pub(super) mod types {
|
||||
#[cfg_attr(target_os = "wasi", allow(unused_imports))]
|
||||
use crate::{
|
||||
builtins::{traceback::PyTracebackRef, PyInt, PyTupleRef, PyTypeRef},
|
||||
function::{FuncArgs, ToPyResult},
|
||||
convert::ToPyResult,
|
||||
function::FuncArgs,
|
||||
PyObjectRef, PyRef, PyResult, VirtualMachine,
|
||||
};
|
||||
use crossbeam_utils::atomic::AtomicCell;
|
||||
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
use crate::{
|
||||
builtins::{PyBaseExceptionRef, PyStrRef},
|
||||
common::float_ops,
|
||||
function::{FuncArgs, ToPyException},
|
||||
convert::ToPyException,
|
||||
function::FuncArgs,
|
||||
stdlib::builtins,
|
||||
AsPyObject, PyObject, PyObjectRef, PyResult, VirtualMachine,
|
||||
};
|
||||
|
||||
+2
-1
@@ -8,9 +8,10 @@ use crate::{
|
||||
PySlice, PyStr, PyStrRef, PyTraceback, PyTypeRef,
|
||||
},
|
||||
bytecode,
|
||||
convert::ToPyResult,
|
||||
coroutine::Coro,
|
||||
exceptions::ExceptionCtor,
|
||||
function::{ArgMapping, FuncArgs, ToPyResult},
|
||||
function::{ArgMapping, FuncArgs},
|
||||
protocol::{PyIter, PyIterReturn},
|
||||
scope::Scope,
|
||||
stdlib::builtins,
|
||||
|
||||
+1
-17
@@ -5,6 +5,7 @@ mod number;
|
||||
|
||||
use crate::{
|
||||
builtins::{PyBaseExceptionRef, PyTupleRef, PyTypeRef},
|
||||
convert::{ToPyObject, ToPyResult},
|
||||
pyobject::{PyObjectPayload, PyThreadingConstraint},
|
||||
AsPyObject, PyObject, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject, VirtualMachine,
|
||||
};
|
||||
@@ -17,27 +18,10 @@ pub use arithmetic::{PyArithmeticValue, PyComparisonValue};
|
||||
pub use buffer::{ArgAsciiBuffer, ArgBytesLike, ArgMemoryBuffer, ArgStrOrBytesLike};
|
||||
pub use number::{ArgIntoBool, ArgIntoComplex, ArgIntoFloat};
|
||||
|
||||
/// Implemented by any type that can be returned from a built-in Python function.
|
||||
///
|
||||
/// `ToPyObject` has a blanket implementation for any built-in object payload,
|
||||
/// and should be implemented by many primitive Rust types, allowing a built-in
|
||||
/// function to simply return a `bool` or a `usize` for example.
|
||||
pub trait ToPyObject {
|
||||
fn to_pyobject(self, vm: &VirtualMachine) -> PyObjectRef;
|
||||
}
|
||||
|
||||
pub trait ToPyResult {
|
||||
fn to_pyresult(self, vm: &VirtualMachine) -> PyResult;
|
||||
}
|
||||
|
||||
pub trait IntoPyRef<T: PyObjectPayload> {
|
||||
fn into_pyref(self, vm: &VirtualMachine) -> PyRef<T>;
|
||||
}
|
||||
|
||||
pub trait ToPyException {
|
||||
fn to_pyexception(self, vm: &VirtualMachine) -> PyBaseExceptionRef;
|
||||
}
|
||||
|
||||
pub trait IntoFuncArgs: Sized {
|
||||
fn into_args(self, vm: &VirtualMachine) -> FuncArgs;
|
||||
fn into_method_args(self, obj: PyObjectRef, vm: &VirtualMachine) -> FuncArgs {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use super::{IntoFuncArgs, ToPyObject};
|
||||
use super::IntoFuncArgs;
|
||||
use crate::{
|
||||
builtins::{iter::PySequenceIterator, PyDict, PyDictRef},
|
||||
protocol::PyIter,
|
||||
protocol::{PyIterIter, PyMapping, PyMappingMethods},
|
||||
convert::ToPyObject,
|
||||
protocol::{PyIter, PyIterIter, PyMapping, PyMappingMethods},
|
||||
AsPyObject, PyObject, PyObjectRef, PyObjectWrap, PyResult, PyValue, TryFromObject,
|
||||
VirtualMachine,
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use crate::{
|
||||
convert::TryFromObject,
|
||||
function::ToPyObject,
|
||||
convert::{ToPyObject, TryFromObject},
|
||||
pyobject::{AsPyObject, PyObjectRef, PyResult},
|
||||
VirtualMachine,
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
builtins::iter::PySequenceIterator,
|
||||
function::{ToPyObject, ToPyResult},
|
||||
convert::{ToPyObject, ToPyResult},
|
||||
AsPyObject, PyObject, PyObjectRef, PyObjectWrap, PyResult, PyValue, TryFromObject,
|
||||
VirtualMachine,
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::{
|
||||
PyDict,
|
||||
},
|
||||
common::lock::OnceCell,
|
||||
function::ToPyResult,
|
||||
convert::ToPyResult,
|
||||
AsPyObject, PyObject, PyObjectRef, PyResult, VirtualMachine,
|
||||
};
|
||||
|
||||
|
||||
@@ -8,8 +8,9 @@ use crate::{
|
||||
},
|
||||
bytesinner::ByteInnerNewOptions,
|
||||
common::{hash::PyHash, str::to_ascii},
|
||||
convert::{ToPyObject, ToPyResult},
|
||||
dictdatatype::DictKey,
|
||||
function::{OptionalArg, PyArithmeticValue, ToPyObject, ToPyResult},
|
||||
function::{OptionalArg, PyArithmeticValue},
|
||||
protocol::{PyIter, PyMapping, PySequence},
|
||||
types::{Constructor, PyComparisonOp},
|
||||
utils::Either,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use crate::{
|
||||
builtins::{PyList, PyListRef, PySlice, PyTuple, PyTupleRef},
|
||||
common::lock::OnceCell,
|
||||
function::{PyArithmeticValue, ToPyObject},
|
||||
convert::ToPyObject,
|
||||
function::PyArithmeticValue,
|
||||
protocol::PyMapping,
|
||||
AsPyObject, PyObject, PyObjectRef, PyResult, PyValue, VirtualMachine,
|
||||
};
|
||||
|
||||
+2
-1
@@ -11,9 +11,10 @@ use crate::{
|
||||
PyType, PyTypeRef,
|
||||
},
|
||||
convert::TryFromObject,
|
||||
convert::{ToPyObject, ToPyResult},
|
||||
dictdatatype::Dict,
|
||||
exceptions,
|
||||
function::{IntoFuncArgs, IntoPyNativeFunc, IntoPyRef, ToPyObject, ToPyResult},
|
||||
function::{IntoFuncArgs, IntoPyNativeFunc, IntoPyRef},
|
||||
pyclass::{PyClassImpl, StaticType},
|
||||
types::{PyTypeFlags, PyTypeSlots, TypeZoo},
|
||||
VirtualMachine,
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
use crate::{
|
||||
builtins::{pystr::IntoPyStrRef, PyDictRef, PyStrRef},
|
||||
function::{ArgMapping, ToPyObject},
|
||||
convert::ToPyObject,
|
||||
function::ArgMapping,
|
||||
VirtualMachine,
|
||||
};
|
||||
use std::fmt;
|
||||
|
||||
+4
-5
@@ -77,9 +77,9 @@ mod _io {
|
||||
PyMappedThreadMutexGuard, PyRwLock, PyRwLockReadGuard, PyRwLockWriteGuard,
|
||||
PyThreadMutex, PyThreadMutexGuard,
|
||||
},
|
||||
convert::ToPyObject,
|
||||
function::{
|
||||
ArgBytesLike, ArgIterable, ArgMemoryBuffer, FuncArgs, OptionalArg, OptionalOption,
|
||||
ToPyObject,
|
||||
},
|
||||
protocol::{
|
||||
BufferDescriptor, BufferMethods, BufferResizeGuard, PyBuffer, PyIterReturn, VecBuffer,
|
||||
@@ -160,7 +160,7 @@ mod _io {
|
||||
fn os_err(vm: &VirtualMachine, err: io::Error) -> PyBaseExceptionRef {
|
||||
#[cfg(any(not(target_arch = "wasm32"), target_os = "wasi"))]
|
||||
{
|
||||
use crate::function::ToPyException;
|
||||
use crate::convert::ToPyException;
|
||||
err.to_pyexception(vm)
|
||||
}
|
||||
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
|
||||
@@ -3656,10 +3656,9 @@ mod fileio {
|
||||
use super::{Offset, _io::*};
|
||||
use crate::{
|
||||
builtins::{PyStr, PyStrRef, PyTypeRef},
|
||||
convert::ToPyException,
|
||||
crt_fd::Fd,
|
||||
function::{
|
||||
ArgBytesLike, ArgMemoryBuffer, FuncArgs, OptionalArg, OptionalOption, ToPyException,
|
||||
},
|
||||
function::{ArgBytesLike, ArgMemoryBuffer, FuncArgs, OptionalArg, OptionalOption},
|
||||
stdlib::os,
|
||||
AsPyObject, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject, VirtualMachine,
|
||||
};
|
||||
|
||||
@@ -8,7 +8,8 @@ mod decl {
|
||||
};
|
||||
use crate::{
|
||||
builtins::{int, PyGenericAlias, PyInt, PyIntRef, PyTuple, PyTupleRef, PyTypeRef},
|
||||
function::{ArgCallable, FuncArgs, OptionalArg, OptionalOption, PosArgs, ToPyObject},
|
||||
convert::ToPyObject,
|
||||
function::{ArgCallable, FuncArgs, OptionalArg, OptionalOption, PosArgs},
|
||||
protocol::{PyIter, PyIterReturn},
|
||||
stdlib::sys,
|
||||
types::{Constructor, IterNext, IterNextIterable},
|
||||
|
||||
@@ -8,7 +8,8 @@ mod decl {
|
||||
PyInt, PyList, PySet, PyStr, PyTuple,
|
||||
},
|
||||
bytecode,
|
||||
function::{ArgBytesLike, ToPyObject},
|
||||
convert::ToPyObject,
|
||||
function::ArgBytesLike,
|
||||
protocol::PyBuffer,
|
||||
pyobject::AsPyObject,
|
||||
PyObjectRef, PyResult, TryFromObject, VirtualMachine,
|
||||
|
||||
+2
-1
@@ -12,8 +12,9 @@ pub(crate) fn make_module(vm: &VirtualMachine) -> PyObjectRef {
|
||||
pub(crate) mod module {
|
||||
use crate::{
|
||||
builtins::{PyStrRef, PyTupleRef},
|
||||
convert::ToPyException,
|
||||
crt_fd::Fd,
|
||||
function::{OptionalArg, ToPyException},
|
||||
function::OptionalArg,
|
||||
stdlib::os::{
|
||||
errno_err, DirFd, FollowSymlinks, PyPathLike, SupportFunc, TargetIsDirectory, _os,
|
||||
errno,
|
||||
|
||||
+4
-2
@@ -1,7 +1,8 @@
|
||||
use crate::{
|
||||
builtins::{PyBaseExceptionRef, PyBytes, PyBytesRef, PyInt, PySet, PyStr, PyStrRef},
|
||||
convert::{ToPyException, ToPyObject},
|
||||
crt_fd::Fd,
|
||||
function::{ArgumentError, FromArgs, FuncArgs, ToPyException, ToPyObject},
|
||||
function::{ArgumentError, FromArgs, FuncArgs},
|
||||
protocol::PyBuffer,
|
||||
AsPyObject, PyObject, PyObjectRef, PyResult, PyValue, TryFromBorrowedObject, TryFromObject,
|
||||
VirtualMachine,
|
||||
@@ -433,8 +434,9 @@ pub(super) mod _os {
|
||||
builtins::{
|
||||
PyBytesRef, PyGenericAlias, PyIntRef, PyStrRef, PyTuple, PyTupleRef, PyTypeRef,
|
||||
},
|
||||
convert::{ToPyException, ToPyObject},
|
||||
crt_fd::{Fd, Offset},
|
||||
function::{ArgBytesLike, FuncArgs, IntoPyRef, OptionalArg, ToPyException, ToPyObject},
|
||||
function::{ArgBytesLike, FuncArgs, IntoPyRef, OptionalArg},
|
||||
protocol::PyIterReturn,
|
||||
suppress_iph,
|
||||
types::{IterNext, IterNextIterable},
|
||||
|
||||
@@ -30,14 +30,15 @@ pub(crate) fn make_module(vm: &VirtualMachine) -> PyObjectRef {
|
||||
pub mod module {
|
||||
use crate::{
|
||||
builtins::{PyDictRef, PyInt, PyIntRef, PyListRef, PyStrRef, PyTupleRef, PyTypeRef},
|
||||
function::{OptionalArg, ToPyException, ToPyObject},
|
||||
convert::{ToPyException, ToPyObject, TryFromObject},
|
||||
function::OptionalArg,
|
||||
stdlib::os::{
|
||||
errno_err, DirFd, FollowSymlinks, PathOrFd, PyPathLike, SupportFunc, TargetIsDirectory,
|
||||
_os, fs_metadata, IOErrorBuilder,
|
||||
},
|
||||
types::Constructor,
|
||||
utils::{Either, ToCString},
|
||||
AsPyObject, PyObjectRef, PyResult, PyValue, TryFromObject, VirtualMachine,
|
||||
AsPyObject, PyObjectRef, PyResult, PyValue, VirtualMachine,
|
||||
};
|
||||
use bitflags::bitflags;
|
||||
use nix::{
|
||||
|
||||
@@ -4,7 +4,7 @@ pub(crate) use pwd::make_module;
|
||||
mod pwd {
|
||||
use crate::{
|
||||
builtins::{PyIntRef, PyStrRef},
|
||||
function::{ToPyException, ToPyObject},
|
||||
convert::{ToPyException, ToPyObject},
|
||||
AsPyObject, PyObjectRef, PyResult, PyStructSequence, VirtualMachine,
|
||||
};
|
||||
use nix::unistd::{self, User};
|
||||
|
||||
@@ -11,7 +11,7 @@ pub(crate) fn make_module(vm: &VirtualMachine) -> PyObjectRef {
|
||||
#[pymodule]
|
||||
pub(crate) mod _signal {
|
||||
use crate::{
|
||||
convert::TryFromBorrowedObject, function::ToPyException, signal, PyObjectRef, PyResult,
|
||||
convert::ToPyException, convert::TryFromBorrowedObject, signal, PyObjectRef, PyResult,
|
||||
VirtualMachine,
|
||||
};
|
||||
use std::sync::atomic::{self, Ordering};
|
||||
|
||||
@@ -8,7 +8,8 @@ mod _sre {
|
||||
PyTupleRef, PyTypeRef,
|
||||
},
|
||||
common::{ascii, hash::PyHash},
|
||||
function::{ArgCallable, OptionalArg, PosArgs, PyComparisonValue, ToPyObject},
|
||||
convert::ToPyObject,
|
||||
function::{ArgCallable, OptionalArg, PosArgs, PyComparisonValue},
|
||||
protocol::{PyBuffer, PyMappingMethods},
|
||||
stdlib::sys,
|
||||
types::{AsMapping, Comparable, Hashable},
|
||||
|
||||
@@ -8,9 +8,9 @@ mod _string {
|
||||
use crate::common::ascii;
|
||||
use crate::{
|
||||
builtins::{PyList, PyStrRef},
|
||||
convert::ToPyException,
|
||||
convert::ToPyObject,
|
||||
format::{FieldName, FieldNamePart, FieldType, FormatPart, FormatString, FromTemplate},
|
||||
function::ToPyException,
|
||||
function::ToPyObject,
|
||||
PyObjectRef, PyResult, VirtualMachine,
|
||||
};
|
||||
use std::mem;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::{function::ToPyObject, pyclass::PyClassImpl, PyObject, PyResult, VirtualMachine};
|
||||
use crate::{convert::ToPyObject, pyclass::PyClassImpl, PyObject, PyResult, VirtualMachine};
|
||||
|
||||
pub(crate) use sys::{MAXSIZE, MULTIARCH};
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@ pub(crate) use _sysconfigdata::make_module;
|
||||
|
||||
#[pymodule]
|
||||
pub(crate) mod _sysconfigdata {
|
||||
use crate::{
|
||||
builtins::PyDictRef, function::ToPyObject, stdlib::sys::MULTIARCH, VirtualMachine,
|
||||
};
|
||||
use crate::{builtins::PyDictRef, convert::ToPyObject, stdlib::sys::MULTIARCH, VirtualMachine};
|
||||
|
||||
#[pyattr]
|
||||
fn build_time_vars(vm: &VirtualMachine) -> PyDictRef {
|
||||
|
||||
@@ -6,7 +6,8 @@ pub(crate) use _thread::{make_module, RawRMutex};
|
||||
pub(crate) mod _thread {
|
||||
use crate::{
|
||||
builtins::{PyDictRef, PyStrRef, PyTupleRef, PyTypeRef},
|
||||
function::{ArgCallable, FuncArgs, KwArgs, OptionalArg, ToPyException},
|
||||
convert::ToPyException,
|
||||
function::{ArgCallable, FuncArgs, KwArgs, OptionalArg},
|
||||
py_io,
|
||||
types::{Constructor, GetAttr, SetAttr},
|
||||
utils::Either,
|
||||
|
||||
@@ -5,7 +5,8 @@ pub(crate) use _winapi::make_module;
|
||||
mod _winapi {
|
||||
use crate::{
|
||||
builtins::PyStrRef,
|
||||
function::{ArgMapping, ArgSequence, OptionalArg, ToPyException},
|
||||
convert::ToPyException,
|
||||
function::{ArgMapping, ArgSequence, OptionalArg},
|
||||
stdlib::os::errno_err,
|
||||
PyObjectRef, PyResult, TryFromObject, VirtualMachine,
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@ pub(crate) fn make_module(vm: &VirtualMachine) -> PyObjectRef {
|
||||
mod winreg {
|
||||
use crate::common::lock::{PyRwLock, PyRwLockReadGuard, PyRwLockWriteGuard};
|
||||
use crate::{
|
||||
builtins::PyStrRef, function::ToPyException, PyObjectRef, PyRef, PyResult, PyValue,
|
||||
builtins::PyStrRef, convert::ToPyException, PyObjectRef, PyRef, PyResult, PyValue,
|
||||
TryFromObject, VirtualMachine,
|
||||
};
|
||||
use ::winreg::{enums::RegType, RegKey, RegValue};
|
||||
|
||||
@@ -2,9 +2,11 @@ pub use crate::builtins::object::{generic_getattr, generic_setattr};
|
||||
use crate::common::{hash::PyHash, lock::PyRwLock};
|
||||
use crate::{
|
||||
builtins::{PyInt, PyStrRef, PyType, PyTypeRef},
|
||||
function::{FromArgs, FuncArgs, OptionalArg, PyComparisonValue, ToPyObject, ToPyResult},
|
||||
protocol::{PyBuffer, PyIterReturn, PyMapping, PyMappingMethods},
|
||||
protocol::{PySequence, PySequenceMethods},
|
||||
convert::{ToPyObject, ToPyResult},
|
||||
function::{FromArgs, FuncArgs, OptionalArg, PyComparisonValue},
|
||||
protocol::{
|
||||
PyBuffer, PyIterReturn, PyMapping, PyMappingMethods, PySequence, PySequenceMethods,
|
||||
},
|
||||
utils::Either,
|
||||
AsPyObject, PyObject, PyObjectRef, PyObjectView, PyRef, PyResult, PyValue, VirtualMachine,
|
||||
};
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
builtins::{PyFloat, PyStr},
|
||||
function::{ToPyException, ToPyObject},
|
||||
convert::{ToPyException, ToPyObject},
|
||||
AsPyObject, PyObject, PyObjectRef, PyObjectWrap, PyResult, TryFromObject, VirtualMachine,
|
||||
};
|
||||
use num_traits::ToPrimitive;
|
||||
|
||||
+2
-1
@@ -17,9 +17,10 @@ use crate::{
|
||||
bytecode,
|
||||
codecs::CodecsRegistry,
|
||||
common::{ascii, hash::HashSecret, lock::PyMutex, rc::PyRc},
|
||||
convert::ToPyObject,
|
||||
frame::{ExecutionResult, Frame, FrameRef},
|
||||
frozen,
|
||||
function::{ArgMapping, FuncArgs, ToPyObject},
|
||||
function::{ArgMapping, FuncArgs},
|
||||
import,
|
||||
protocol::PyIterIter,
|
||||
pyobject::PyLease,
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ use crate::{
|
||||
tuple::{IntoPyTuple, PyTupleRef},
|
||||
PyBaseException, PyBaseExceptionRef, PyDictRef, PyModule, PyStrRef, PyTypeRef,
|
||||
},
|
||||
function::ToPyObject,
|
||||
convert::ToPyObject,
|
||||
scope::Scope,
|
||||
vm::VirtualMachine,
|
||||
AsPyObject, PyObject, PyObjectRef, PyObjectWrap, PyRef,
|
||||
|
||||
@@ -8,7 +8,8 @@ mod _browser {
|
||||
use js_sys::Promise;
|
||||
use rustpython_vm::{
|
||||
builtins::{PyDictRef, PyStrRef},
|
||||
function::{ArgCallable, OptionalArg, ToPyObject},
|
||||
convert::ToPyObject,
|
||||
function::{ArgCallable, OptionalArg},
|
||||
import::import_file,
|
||||
pyclass::PyClassImpl,
|
||||
PyObjectRef, PyRef, PyResult, PyValue, VirtualMachine,
|
||||
|
||||
@@ -14,7 +14,8 @@ mod _js {
|
||||
use js_sys::{Array, Object, Promise, Reflect};
|
||||
use rustpython_vm::{
|
||||
builtins::{PyBaseExceptionRef, PyFloat, PyStrRef, PyTypeRef},
|
||||
function::{ArgCallable, OptionalArg, OptionalOption, PosArgs, ToPyObject},
|
||||
convert::ToPyObject,
|
||||
function::{ArgCallable, OptionalArg, OptionalOption, PosArgs},
|
||||
protocol::PyIterReturn,
|
||||
types::{IterNext, IterNextIterable},
|
||||
PyObjectRef, PyObjectView, PyObjectWrap, PyRef, PyResult, PyValue, TryFromObject,
|
||||
|
||||
Reference in new issue
Block a user