@@ -535,18 +535,17 @@ impl PyObject {
535535 /// Real isinstance check without going through __instancecheck__
536536 /// This is equivalent to CPython's _PyObject_RealIsInstance/object_isinstance
537537 pub fn real_is_instance ( & self , cls : & PyObject , vm : & VirtualMachine ) -> PyResult < bool > {
538- if let Ok ( typ ) = cls. try_to_ref :: < PyType > ( vm) {
538+ if let Ok ( cls ) = cls. try_to_ref :: < PyType > ( vm) {
539539 // PyType_Check(cls) - cls is a type object
540- let mut retval = self . fast_isinstance ( typ) ;
541-
540+ let mut retval = self . class ( ) . is_subtype ( cls) ;
542541 if !retval {
543542 // Check __class__ attribute, only masking AttributeError
544543 if let Some ( i_cls) =
545544 vm. get_attribute_opt ( self . to_owned ( ) , identifier ! ( vm, __class__) ) ?
546545 {
547546 if let Ok ( i_cls_type) = PyTypeRef :: try_from_object ( vm, i_cls) {
548547 if !i_cls_type. is ( self . class ( ) ) {
549- retval = i_cls_type. fast_issubclass ( typ ) ;
548+ retval = i_cls_type. is_subtype ( cls ) ;
550549 }
551550 }
552551 }
@@ -565,11 +564,7 @@ impl PyObject {
565564 if let Some ( i_cls) =
566565 vm. get_attribute_opt ( self . to_owned ( ) , identifier ! ( vm, __class__) ) ?
567566 {
568- if vm. is_none ( & i_cls) {
569- Ok ( false )
570- } else {
571- i_cls. abstract_issubclass ( cls, vm)
572- }
567+ i_cls. abstract_issubclass ( cls, vm)
573568 } else {
574569 Ok ( false )
575570 }
0 commit comments