There was an error while loading. Please reload this page.
1 parent 9be1dc1 commit 625f867Copy full SHA for 625f867
68 files changed
src/lib.rs
@@ -51,8 +51,8 @@ use rustpython_vm::{
51
compile, match_class,
52
scope::Scope,
53
stdlib::{atexit, sys},
54
- InitParameter, Interpreter, PyObjectRef, PyResult, PySettings, TryFromObject, TypeProtocol,
55
- VirtualMachine,
+ AsPyObject, InitParameter, Interpreter, PyObjectRef, PyResult, PySettings, TryFromObject,
+ TypeProtocol, VirtualMachine,
56
};
57
use std::{env, path::Path, process, str::FromStr};
58
@@ -536,12 +536,8 @@ fn setup_main_module(vm: &VirtualMachine) -> PyResult<Scope> {
536
main_module
537
.dict()
538
.and_then(|d| {
539
- d.set_item(
540
- "__annotations__",
541
- vm.ctx.new_dict().as_object().to_owned(),
542
- vm,
543
- )
544
- .ok()
+ d.set_item("__annotations__", vm.ctx.new_dict().into(), vm)
+ .ok()
545
})
546
.expect("Failed to initialize __main__.__annotations__");
547
src/shell/helper.rs
@@ -85,9 +85,8 @@ impl<'vm> ShellHelper<'vm> {
85
} else {
86
// we need to get a variable based off of globals/builtins
87
88
- let globals = str_iter_method(self.globals.as_object().to_owned(), "keys").ok()?;
89
- let builtins =
90
- str_iter_method(self.vm.builtins.as_object().to_owned(), "__dir__").ok()?;
+ let globals = str_iter_method(self.globals.clone().into(), "keys").ok()?;
+ let builtins = str_iter_method(self.vm.builtins.clone().into(), "__dir__").ok()?;
91
(first, globals, Some(builtins))
92
93
Some((word_start, iter1.chain(iter2.into_iter().flatten())))
stdlib/src/array.rs
@@ -33,14 +33,13 @@ mod array {
33
AsBuffer, AsMapping, Comparable, Constructor, IterNext, IterNextIterable, Iterable,
34
PyComparisonOp,
35
},
36
- IdProtocol, PyObject, PyObjectRef, PyObjectView, PyObjectWrap, PyRef, PyResult,
37
- PyValue, TryFromBorrowedObject, TryFromObject, TypeProtocol, VirtualMachine,
+ AsPyObject, PyObject, PyObjectRef, PyObjectView, PyRef, PyResult, PyValue,
+ TryFromBorrowedObject, TryFromObject, TypeProtocol, VirtualMachine,
38
39
40
use itertools::Itertools;
41
use num_traits::ToPrimitive;
42
- use std::cmp::Ordering;
43
- use std::{fmt, os::raw};
+ use std::{cmp::Ordering, fmt, os::raw};
44
45
macro_rules! def_array_enum {
46
($(($n:ident, $t:ty, $c:literal, $scode:literal)),*$(,)?) => {
stdlib/src/json.rs
@@ -9,7 +9,7 @@ mod _json {
9
function::{IntoPyObject, IntoPyResult, OptionalArg},
10
protocol::PyIterReturn,
11
types::{Callable, Constructor},
12
- IdProtocol, PyObjectRef, PyObjectView, PyResult, PyValue, VirtualMachine,
+ AsPyObject, PyObjectRef, PyObjectView, PyResult, PyValue, VirtualMachine,
13
14
use num_bigint::BigInt;
15
use std::str::FromStr;
vm/src/builtins/asyncgenerator.rs
@@ -7,7 +7,7 @@ use crate::{
7
8
pyclass::PyClassImpl,
types::{Constructor, IterNext, IterNextIterable, Unconstructible},
- IdProtocol, PyContext, PyObjectRef, PyRef, PyResult, PyValue, TypeProtocol, VirtualMachine,
+ AsPyObject, PyContext, PyObjectRef, PyRef, PyResult, PyValue, TypeProtocol, VirtualMachine,
use crossbeam_utils::atomic::AtomicCell;
vm/src/builtins/bytearray.rs
@@ -33,7 +33,7 @@ use crate::{
IterNextIterable, Iterable, PyComparisonOp, Unconstructible, Unhashable,
utils::Either,
- IdProtocol, PyContext, PyObject, PyObjectRef, PyObjectView, PyObjectWrap, PyRef, PyResult,
+ AsPyObject, PyContext, PyObject, PyObjectRef, PyObjectView, PyObjectWrap, PyRef, PyResult,
PyValue, TryFromBorrowedObject, TryFromObject, TypeProtocol, VirtualMachine,
use bstr::ByteSlice;
vm/src/builtins/bytes.rs
@@ -22,7 +22,7 @@ use crate::{
22
IterNextIterable, Iterable, PyComparisonOp, Unconstructible,
23
24
25
26
27
28
vm/src/builtins/code.rs
bytecode::{self, BorrowedConstant, Constant, ConstantBag},
function::FuncArgs,
pyclass::{PyClassImpl, StaticType},
- IdProtocol, PyContext, PyObject, PyObjectRef, PyRef, PyResult, PyValue, TypeProtocol,
+ AsPyObject, PyContext, PyObject, PyObjectRef, PyRef, PyResult, PyValue, TypeProtocol,
VirtualMachine,
use num_traits::Zero;
vm/src/builtins/complex.rs
types::{Comparable, Constructor, Hashable, PyComparisonOp},
use num_complex::Complex64;
vm/src/builtins/coroutine.rs
@@ -6,7 +6,7 @@ use crate::{
6
- IdProtocol, PyContext, PyObjectRef, PyRef, PyResult, PyValue, VirtualMachine,
+ AsPyObject, PyContext, PyObjectRef, PyRef, PyResult, PyValue, VirtualMachine,
#[pyclass(module = false, name = "coroutine")]
0 commit comments