Skip to content

Commit 59723c7

Browse files
committed
DerefToClass->DerefToType
1 parent 209d6be commit 59723c7

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

vm/src/obj/objtype.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -596,25 +596,25 @@ pub(crate) fn init(ctx: &PyContext) {
596596
PyType::extend_class(ctx, &ctx.types.type_type);
597597
}
598598

599-
pub trait DerefToPyClass {
600-
fn deref_to_class(&self) -> &PyType;
599+
pub trait DerefToPyType {
600+
fn deref_to_type(&self) -> &PyType;
601601
}
602602

603-
impl DerefToPyClass for PyTypeRef {
604-
fn deref_to_class(&self) -> &PyType {
603+
impl DerefToPyType for PyTypeRef {
604+
fn deref_to_type(&self) -> &PyType {
605605
self.deref()
606606
}
607607
}
608608

609-
impl<'a> DerefToPyClass for PyLease<'a, PyType> {
610-
fn deref_to_class(&self) -> &PyType {
609+
impl<'a> DerefToPyType for PyLease<'a, PyType> {
610+
fn deref_to_type(&self) -> &PyType {
611611
self.deref()
612612
}
613613
}
614614

615-
impl<T: DerefToPyClass> DerefToPyClass for &'_ T {
616-
fn deref_to_class(&self) -> &PyType {
617-
(&**self).deref_to_class()
615+
impl<T: DerefToPyType> DerefToPyType for &'_ T {
616+
fn deref_to_type(&self) -> &PyType {
617+
(&**self).deref_to_type()
618618
}
619619
}
620620

@@ -628,8 +628,8 @@ pub fn isinstance<T: TypeProtocol>(obj: &T, cls: &PyTypeRef) -> bool {
628628
/// Determines if `subclass` is actually a subclass of `cls`, this doesn't call __subclasscheck__,
629629
/// so only use this if `cls` is known to have not overridden the base __subclasscheck__ magic
630630
/// method.
631-
pub fn issubclass<T: DerefToPyClass + IdProtocol, R: IdProtocol>(subclass: T, cls: R) -> bool {
632-
subclass.is(&cls) || subclass.deref_to_class().mro.iter().any(|c| c.is(&cls))
631+
pub fn issubclass<T: DerefToPyType + IdProtocol, R: IdProtocol>(subclass: T, cls: R) -> bool {
632+
subclass.is(&cls) || subclass.deref_to_type().mro.iter().any(|c| c.is(&cls))
633633
}
634634

635635
fn call_tp_new(

0 commit comments

Comments
 (0)