Skip to content

Commit d8a73ea

Browse files
committed
Make it unnecessary to import PyClassImpl for #[pymodule]
1 parent 3b2db89 commit d8a73ea

10 files changed

Lines changed: 11 additions & 15 deletions

File tree

derive/src/pymodule.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ impl ModuleItem for ClassItem {
318318
.optional_name()
319319
.unwrap_or_else(|| class_name.clone());
320320
let new_class = quote_spanned!(ident.span() =>
321-
#ident::make_class(&vm.ctx);
321+
<#ident as ::rustpython_vm::pyobject::PyClassImpl>::make_class(&vm.ctx);
322322
);
323323
let item = quote! {
324324
let new_class = #new_class;

vm/src/stdlib/collections.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ mod _collections {
55
use crate::common::cell::{PyRwLock, PyRwLockReadGuard, PyRwLockWriteGuard};
66
use crate::function::OptionalArg;
77
use crate::obj::{objiter, objsequence, objtype::PyTypeRef};
8-
use crate::pyobject::{
9-
PyClassImpl, PyComparisonValue, PyIterable, PyObjectRef, PyRef, PyResult, PyValue,
10-
};
8+
use crate::pyobject::{PyComparisonValue, PyIterable, PyObjectRef, PyRef, PyResult, PyValue};
119
use crate::sequence;
1210
use crate::slots::{Comparable, PyComparisonOp};
1311
use crate::vm::ReprGuard;

vm/src/stdlib/hashlib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mod hashlib {
77
use crate::obj::objbytes::{PyBytes, PyBytesRef};
88
use crate::obj::objstr::PyStrRef;
99
use crate::obj::objtype::PyTypeRef;
10-
use crate::pyobject::{BorrowValue, PyClassImpl, PyResult, PyValue};
10+
use crate::pyobject::{BorrowValue, PyResult, PyValue};
1111
use crate::vm::VirtualMachine;
1212
use std::fmt;
1313

vm/src/stdlib/itertools.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ mod decl {
1717
use crate::obj::objtuple::PyTupleRef;
1818
use crate::obj::objtype::{self, PyTypeRef};
1919
use crate::pyobject::{
20-
BorrowValue, IdProtocol, IntoPyRef, PyCallable, PyClassImpl, PyObjectRc, PyObjectRef,
21-
PyObjectWeak, PyRef, PyResult, PyValue, TypeProtocol,
20+
BorrowValue, IdProtocol, IntoPyRef, PyCallable, PyObjectRc, PyObjectRef, PyObjectWeak,
21+
PyRef, PyResult, PyValue, TypeProtocol,
2222
};
2323
use crate::vm::VirtualMachine;
2424

vm/src/stdlib/json.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ mod _json {
77
use crate::obj::objiter;
88
use crate::obj::objstr::PyStrRef;
99
use crate::obj::{objbool, objtype::PyTypeRef};
10-
use crate::pyobject::{
11-
BorrowValue, IdProtocol, PyClassImpl, PyObjectRef, PyRef, PyResult, PyValue,
12-
};
10+
use crate::pyobject::{BorrowValue, IdProtocol, PyObjectRef, PyRef, PyResult, PyValue};
1311
use crate::slots::Callable;
1412
use crate::VirtualMachine;
1513

vm/src/stdlib/os.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate::obj::objstr::{PyStr, PyStrRef};
2323
use crate::obj::objtuple::PyTupleRef;
2424
use crate::obj::objtype::PyTypeRef;
2525
use crate::pyobject::{
26-
BorrowValue, Either, IntoPyObject, ItemProtocol, PyClassImpl, PyObjectRef, PyRef, PyResult,
26+
BorrowValue, Either, IntoPyObject, ItemProtocol, PyObjectRef, PyRef, PyResult,
2727
PyStructSequence, PyValue, TryFromObject, TypeProtocol,
2828
};
2929
use crate::vm::VirtualMachine;

vm/src/stdlib/pystruct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ mod _struct {
3030
objtuple::PyTupleRef, objtype::PyTypeRef,
3131
};
3232
use crate::pyobject::{
33-
BorrowValue, Either, PyClassImpl, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject,
33+
BorrowValue, Either, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject,
3434
};
3535
use crate::VirtualMachine;
3636

vm/src/stdlib/random.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ mod _random {
88
use crate::function::OptionalOption;
99
use crate::obj::objint::PyIntRef;
1010
use crate::obj::objtype::PyTypeRef;
11-
use crate::pyobject::{BorrowValue, PyClassImpl, PyRef, PyResult, PyValue};
11+
use crate::pyobject::{BorrowValue, PyRef, PyResult, PyValue};
1212
use crate::VirtualMachine;
1313
use num_bigint::{BigInt, Sign};
1414
use num_traits::Signed;

vm/src/stdlib/symtable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod decl {
66

77
use crate::obj::objstr::PyStrRef;
88
use crate::obj::objtype::PyTypeRef;
9-
use crate::pyobject::{BorrowValue, PyClassImpl, PyRef, PyResult, PyValue};
9+
use crate::pyobject::{BorrowValue, PyRef, PyResult, PyValue};
1010
use crate::vm::VirtualMachine;
1111
use rustpython_compiler::{compile, error::CompileError, symboltable};
1212
use rustpython_parser::parser;

vm/src/stdlib/zlib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ mod decl {
88
use crate::function::OptionalArg;
99
use crate::obj::objbytes::{PyBytes, PyBytesRef};
1010
use crate::obj::objtype::PyTypeRef;
11-
use crate::pyobject::{BorrowValue, IntoPyRef, PyClassImpl, PyResult, PyValue};
11+
use crate::pyobject::{BorrowValue, IntoPyRef, PyResult, PyValue};
1212
use crate::types::create_type;
1313
use crate::vm::VirtualMachine;
1414

0 commit comments

Comments
 (0)