Make it unnecessary to import PyClassImpl for #[pymodule]

This commit is contained in:
Noah
2020-09-30 11:33:22 -05:00
parent 3b2db89d1e
commit d8a73ead42
10 changed files with 11 additions and 15 deletions

View File

@@ -318,7 +318,7 @@ impl ModuleItem for ClassItem {
.optional_name()
.unwrap_or_else(|| class_name.clone());
let new_class = quote_spanned!(ident.span() =>
#ident::make_class(&vm.ctx);
<#ident as ::rustpython_vm::pyobject::PyClassImpl>::make_class(&vm.ctx);
);
let item = quote! {
let new_class = #new_class;

View File

@@ -5,9 +5,7 @@ mod _collections {
use crate::common::cell::{PyRwLock, PyRwLockReadGuard, PyRwLockWriteGuard};
use crate::function::OptionalArg;
use crate::obj::{objiter, objsequence, objtype::PyTypeRef};
use crate::pyobject::{
PyClassImpl, PyComparisonValue, PyIterable, PyObjectRef, PyRef, PyResult, PyValue,
};
use crate::pyobject::{PyComparisonValue, PyIterable, PyObjectRef, PyRef, PyResult, PyValue};
use crate::sequence;
use crate::slots::{Comparable, PyComparisonOp};
use crate::vm::ReprGuard;

View File

@@ -7,7 +7,7 @@ mod hashlib {
use crate::obj::objbytes::{PyBytes, PyBytesRef};
use crate::obj::objstr::PyStrRef;
use crate::obj::objtype::PyTypeRef;
use crate::pyobject::{BorrowValue, PyClassImpl, PyResult, PyValue};
use crate::pyobject::{BorrowValue, PyResult, PyValue};
use crate::vm::VirtualMachine;
use std::fmt;

View File

@@ -17,8 +17,8 @@ mod decl {
use crate::obj::objtuple::PyTupleRef;
use crate::obj::objtype::{self, PyTypeRef};
use crate::pyobject::{
BorrowValue, IdProtocol, IntoPyRef, PyCallable, PyClassImpl, PyObjectRc, PyObjectRef,
PyObjectWeak, PyRef, PyResult, PyValue, TypeProtocol,
BorrowValue, IdProtocol, IntoPyRef, PyCallable, PyObjectRc, PyObjectRef, PyObjectWeak,
PyRef, PyResult, PyValue, TypeProtocol,
};
use crate::vm::VirtualMachine;

View File

@@ -7,9 +7,7 @@ mod _json {
use crate::obj::objiter;
use crate::obj::objstr::PyStrRef;
use crate::obj::{objbool, objtype::PyTypeRef};
use crate::pyobject::{
BorrowValue, IdProtocol, PyClassImpl, PyObjectRef, PyRef, PyResult, PyValue,
};
use crate::pyobject::{BorrowValue, IdProtocol, PyObjectRef, PyRef, PyResult, PyValue};
use crate::slots::Callable;
use crate::VirtualMachine;

View File

@@ -23,7 +23,7 @@ use crate::obj::objstr::{PyStr, PyStrRef};
use crate::obj::objtuple::PyTupleRef;
use crate::obj::objtype::PyTypeRef;
use crate::pyobject::{
BorrowValue, Either, IntoPyObject, ItemProtocol, PyClassImpl, PyObjectRef, PyRef, PyResult,
BorrowValue, Either, IntoPyObject, ItemProtocol, PyObjectRef, PyRef, PyResult,
PyStructSequence, PyValue, TryFromObject, TypeProtocol,
};
use crate::vm::VirtualMachine;

View File

@@ -30,7 +30,7 @@ mod _struct {
objtuple::PyTupleRef, objtype::PyTypeRef,
};
use crate::pyobject::{
BorrowValue, Either, PyClassImpl, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject,
BorrowValue, Either, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject,
};
use crate::VirtualMachine;

View File

@@ -8,7 +8,7 @@ mod _random {
use crate::function::OptionalOption;
use crate::obj::objint::PyIntRef;
use crate::obj::objtype::PyTypeRef;
use crate::pyobject::{BorrowValue, PyClassImpl, PyRef, PyResult, PyValue};
use crate::pyobject::{BorrowValue, PyRef, PyResult, PyValue};
use crate::VirtualMachine;
use num_bigint::{BigInt, Sign};
use num_traits::Signed;

View File

@@ -6,7 +6,7 @@ mod decl {
use crate::obj::objstr::PyStrRef;
use crate::obj::objtype::PyTypeRef;
use crate::pyobject::{BorrowValue, PyClassImpl, PyRef, PyResult, PyValue};
use crate::pyobject::{BorrowValue, PyRef, PyResult, PyValue};
use crate::vm::VirtualMachine;
use rustpython_compiler::{compile, error::CompileError, symboltable};
use rustpython_parser::parser;

View File

@@ -8,7 +8,7 @@ mod decl {
use crate::function::OptionalArg;
use crate::obj::objbytes::{PyBytes, PyBytesRef};
use crate::obj::objtype::PyTypeRef;
use crate::pyobject::{BorrowValue, IntoPyRef, PyClassImpl, PyResult, PyValue};
use crate::pyobject::{BorrowValue, IntoPyRef, PyResult, PyValue};
use crate::types::create_type;
use crate::vm::VirtualMachine;