mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 11:14:38 +08:00
Don't require objtype import to use arg_check! macro
This commit is contained in:
1 parent
e2ee933256
commit
eec76ef8e8
24 files changed
+8
-25
No files matched your search
+1
-1
@@ -15,7 +15,7 @@ macro_rules! type_check {
|
||||
// None indicates that we have no type requirement (i.e. we accept any type)
|
||||
if let Some(expected_type) = $arg_type {
|
||||
let arg = &$args.args[$arg_count];
|
||||
if !objtype::isinstance(arg, &expected_type) {
|
||||
if !$crate::obj::objtype::isinstance(arg, &expected_type) {
|
||||
let arg_typ = arg.typ();
|
||||
let expected_type_name = $vm.to_pystr(&expected_type)?;
|
||||
let actual_type = $vm.to_pystr(&arg_typ)?;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
*/
|
||||
|
||||
use super::objtype;
|
||||
use crate::bytecode;
|
||||
use crate::pyobject::{
|
||||
IdProtocol, PyContext, PyFuncArgs, PyObjectPayload, PyObjectRef, PyResult, TypeProtocol,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use super::objint;
|
||||
use super::objiter;
|
||||
use super::objtype; // Required for arg_check! to use isinstance
|
||||
use crate::pyobject::{PyContext, PyFuncArgs, PyObject, PyObjectPayload, PyResult, TypeProtocol};
|
||||
use crate::vm::VirtualMachine;
|
||||
use num_bigint::BigInt;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use super::objbool;
|
||||
use super::objiter;
|
||||
use super::objtype;
|
||||
use crate::pyobject::{
|
||||
IdProtocol, PyContext, PyFuncArgs, PyObject, PyObjectPayload, PyResult, TypeProtocol,
|
||||
};
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
*/
|
||||
|
||||
use super::objtype;
|
||||
use crate::frame::Frame;
|
||||
use crate::pyobject::{
|
||||
PyContext, PyFuncArgs, PyObjectPayload, PyObjectRef, PyResult, TypeProtocol,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use super::objtype;
|
||||
use crate::pyobject::{
|
||||
AttributeProtocol, IdProtocol, PyContext, PyFuncArgs, PyObjectPayload, PyResult, TypeProtocol,
|
||||
};
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* The mythical generator.
|
||||
*/
|
||||
|
||||
use super::objtype;
|
||||
use crate::frame::{ExecutionResult, Frame};
|
||||
use crate::pyobject::{
|
||||
PyContext, PyFuncArgs, PyObject, PyObjectPayload, PyObjectRef, PyResult, TypeProtocol,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use super::objiter;
|
||||
use super::objtype;
|
||||
use crate::pyobject::{PyContext, PyFuncArgs, PyObject, PyObjectPayload, PyResult, TypeProtocol};
|
||||
use crate::vm::VirtualMachine; // Required for arg_check! to use isinstance
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
use super::objtype;
|
||||
|
||||
use crate::pyobject::{PyContext, PyFuncArgs, PyObject, PyObjectPayload, PyResult, TypeProtocol};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use super::objtype;
|
||||
use crate::pyobject::{PyContext, PyFuncArgs, PyResult, TypeProtocol};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
*/
|
||||
|
||||
use super::objtype;
|
||||
use crate::pyobject::{PyContext, PyFuncArgs, PyResult, TypeProtocol};
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use super::objint;
|
||||
use super::objtype; // Required for arg_check! to use isinstance
|
||||
use crate::pyobject::{
|
||||
PyContext, PyFuncArgs, PyObject, PyObjectPayload, PyObjectRef, PyResult, TypeProtocol,
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use super::objiter;
|
||||
use super::objtype;
|
||||
use crate::pyobject::{PyContext, PyFuncArgs, PyObject, PyObjectPayload, PyResult, TypeProtocol};
|
||||
use crate::vm::VirtualMachine; // Required for arg_check! to use isinstance
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
extern crate rustpython_parser;
|
||||
|
||||
use self::rustpython_parser::{ast, parser};
|
||||
use crate::obj::{objstr, objtype};
|
||||
use crate::obj::objstr;
|
||||
use crate::pyobject::{PyContext, PyFuncArgs, PyObjectRef, PyResult, TypeProtocol};
|
||||
use crate::VirtualMachine;
|
||||
use num_complex::Complex64;
|
||||
|
||||
@@ -17,7 +17,6 @@ use super::os;
|
||||
use crate::obj::objbytes;
|
||||
use crate::obj::objint;
|
||||
use crate::obj::objstr;
|
||||
use crate::obj::objtype;
|
||||
|
||||
use crate::pyobject::{
|
||||
AttributeProtocol, BufferProtocol, PyContext, PyFuncArgs, PyObjectPayload, PyObjectRef,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
extern crate rustpython_parser;
|
||||
use self::rustpython_parser::lexer;
|
||||
use crate::obj::{objstr, objtype};
|
||||
use crate::obj::objstr;
|
||||
use crate::pyobject::{PyContext, PyFuncArgs, PyObjectRef, PyResult, TypeProtocol};
|
||||
use crate::VirtualMachine;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
use crate::obj::{objfloat, objtype};
|
||||
use crate::obj::objfloat;
|
||||
use crate::pyobject::{PyContext, PyFuncArgs, PyObjectRef, PyResult, TypeProtocol};
|
||||
use crate::VirtualMachine;
|
||||
use statrs::function::erf::{erf, erfc};
|
||||
|
||||
@@ -10,7 +10,6 @@ use num_traits::cast::ToPrimitive;
|
||||
//custom imports
|
||||
use crate::obj::objint;
|
||||
use crate::obj::objstr;
|
||||
use crate::obj::objtype;
|
||||
// use crate::obj::objdict;
|
||||
|
||||
use crate::pyobject::{PyContext, PyFuncArgs, PyObjectRef, PyResult, TypeProtocol};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
extern crate rand;
|
||||
|
||||
use crate::obj::{objfloat, objtype};
|
||||
use crate::obj::objfloat;
|
||||
use crate::pyobject::{PyContext, PyFuncArgs, PyObjectRef, PyResult, TypeProtocol};
|
||||
use crate::stdlib::random::rand::distributions::{Distribution, Normal};
|
||||
use crate::VirtualMachine;
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
extern crate regex;
|
||||
use self::regex::Regex;
|
||||
|
||||
use crate::obj::{objstr, objtype};
|
||||
use crate::obj::objstr;
|
||||
use crate::pyobject::{PyContext, PyFuncArgs, PyObjectRef, PyResult, TypeProtocol};
|
||||
use crate::VirtualMachine;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! The python `time` module.
|
||||
|
||||
use crate::obj::{objfloat, objtype};
|
||||
use crate::obj::objfloat;
|
||||
use crate::pyobject::{PyContext, PyFuncArgs, PyObjectRef, PyResult, TypeProtocol};
|
||||
use crate::VirtualMachine;
|
||||
use std::thread;
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::iter::FromIterator;
|
||||
|
||||
use self::rustpython_parser::lexer;
|
||||
|
||||
use crate::obj::{objstr, objtype};
|
||||
use crate::obj::objstr;
|
||||
use crate::pyobject::{PyContext, PyFuncArgs, PyObjectRef, PyResult, TypeProtocol};
|
||||
use crate::VirtualMachine;
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
//! - [rust weak struct](https://doc.rust-lang.org/std/rc/struct.Weak.html)
|
||||
//!
|
||||
|
||||
use crate::obj::objtype;
|
||||
use crate::pyobject::{
|
||||
PyContext, PyFuncArgs, PyObject, PyObjectPayload, PyObjectRef, PyObjectWeakRef, PyResult,
|
||||
TypeProtocol,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use crate::obj::objtype;
|
||||
use crate::pyobject::{PyContext, PyFuncArgs, PyObjectRef, PyResult, TypeProtocol};
|
||||
use crate::vm::VirtualMachine;
|
||||
use std::rc::Rc;
|
||||
|
||||
Reference in new issue
Block a user