Skip to content

Commit a8e064b

Browse files
committed
Import TypeProtocol before use in type_check!
1 parent daaeb78 commit a8e064b

File tree

15 files changed

+15
-16
lines changed

15 files changed

+15
-16
lines changed

vm/src/macros.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ macro_rules! type_check {
2020
let arg = &$args.args[$arg_count];
2121

2222
if !$crate::obj::objtype::isinstance(arg, &expected_type) {
23+
use $crate::pyobject::TypeProtocol;
24+
2325
let arg_typ = arg.class();
2426
let expected_type_name = $vm.to_pystr(&expected_type)?;
2527
let actual_type = $vm.to_pystr(&arg_typ)?;

vm/src/obj/objbool.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
use num_traits::Zero;
22

33
use crate::function::PyFuncArgs;
4-
use crate::pyobject::{
5-
IntoPyObject, PyContext, PyObjectRef, PyResult, TryFromObject, TypeProtocol,
6-
};
4+
use crate::pyobject::{IntoPyObject, PyContext, PyObjectRef, PyResult, TryFromObject};
75
use crate::vm::VirtualMachine;
86

97
use super::objint::PyInt;

vm/src/obj/objellipsis.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::function::PyFuncArgs;
2-
use crate::pyobject::{PyContext, PyResult, TypeProtocol};
2+
use crate::pyobject::{PyContext, PyResult};
33
use crate::vm::VirtualMachine;
44

55
pub fn init(context: &PyContext) {

vm/src/obj/objlist.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use num_traits::{One, Signed, ToPrimitive, Zero};
99
use crate::function::{OptionalArg, PyFuncArgs};
1010
use crate::pyobject::{
1111
IdProtocol, PyContext, PyIterable, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject,
12-
TypeProtocol,
1312
};
1413
use crate::vm::{ReprGuard, VirtualMachine};
1514

vm/src/obj/objslice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use num_bigint::BigInt;
22

33
use crate::function::PyFuncArgs;
4-
use crate::pyobject::{PyContext, PyObjectRef, PyRef, PyResult, PyValue, TypeProtocol};
4+
use crate::pyobject::{PyContext, PyObjectRef, PyRef, PyResult, PyValue};
55
use crate::vm::VirtualMachine;
66

77
use super::objint;

vm/src/stdlib/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use crate::obj::objbytes;
2020
use crate::obj::objint;
2121
use crate::obj::objstr;
2222
use crate::obj::objtype::PyClassRef;
23-
use crate::pyobject::{BufferProtocol, PyObjectRef, PyRef, PyResult, PyValue, TypeProtocol};
23+
use crate::pyobject::{BufferProtocol, PyObjectRef, PyRef, PyResult, PyValue};
2424
use crate::vm::VirtualMachine;
2525

2626
fn compute_c_flag(mode: &str) -> u16 {

vm/src/stdlib/keyword.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustpython_parser::lexer;
66

77
use crate::function::PyFuncArgs;
88
use crate::obj::objstr;
9-
use crate::pyobject::{PyObjectRef, PyResult, TypeProtocol};
9+
use crate::pyobject::{PyObjectRef, PyResult};
1010
use crate::vm::VirtualMachine;
1111

1212
fn keyword_iskeyword(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {

vm/src/stdlib/math.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use statrs::function::gamma::{gamma, ln_gamma};
88

99
use crate::function::PyFuncArgs;
1010
use crate::obj::objfloat;
11-
use crate::pyobject::{PyObjectRef, PyResult, TypeProtocol};
11+
use crate::pyobject::{PyObjectRef, PyResult};
1212
use crate::vm::VirtualMachine;
1313

1414
// Helper macro:

vm/src/stdlib/os.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::obj::objint;
1212
use crate::obj::objint::PyIntRef;
1313
use crate::obj::objstr;
1414
use crate::obj::objstr::PyStringRef;
15-
use crate::pyobject::{ItemProtocol, PyObjectRef, PyResult, TypeProtocol};
15+
use crate::pyobject::{ItemProtocol, PyObjectRef, PyResult};
1616
use crate::vm::VirtualMachine;
1717

1818
#[cfg(unix)]

vm/src/stdlib/pystruct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use num_traits::ToPrimitive;
1515

1616
use crate::function::PyFuncArgs;
1717
use crate::obj::{objbool, objbytes, objfloat, objint, objstr, objtype};
18-
use crate::pyobject::{PyObjectRef, PyResult, TypeProtocol};
18+
use crate::pyobject::{PyObjectRef, PyResult};
1919
use crate::VirtualMachine;
2020

2121
#[derive(Debug)]

0 commit comments

Comments
 (0)