@@ -667,11 +667,12 @@ impl GetAttr for PyType {
667667
668668 if let Some ( ref attr) = mcl_attr {
669669 let attr_class = attr. class ( ) ;
670- if attr_class
670+ let has_descr_set = attr_class
671671 . mro_find_map ( |cls| cls. slots . descr_set . load ( ) )
672- . is_some ( )
673- {
674- if let Some ( descr_get) = attr_class. mro_find_map ( |cls| cls. slots . descr_get . load ( ) ) {
672+ . is_some ( ) ;
673+ if has_descr_set {
674+ let descr_get = attr_class. mro_find_map ( |cls| cls. slots . descr_get . load ( ) ) ;
675+ if let Some ( descr_get) = descr_get {
675676 let mcl = mcl. into_owned ( ) . into ( ) ;
676677 return descr_get ( attr. clone ( ) , Some ( zelf. to_owned ( ) . into ( ) ) , Some ( mcl) , vm) ;
677678 }
@@ -681,7 +682,8 @@ impl GetAttr for PyType {
681682 let zelf_attr = zelf. get_attr ( name) ;
682683
683684 if let Some ( ref attr) = zelf_attr {
684- if let Some ( descr_get) = attr. class ( ) . mro_find_map ( |cls| cls. slots . descr_get . load ( ) ) {
685+ let descr_get = attr. class ( ) . mro_find_map ( |cls| cls. slots . descr_get . load ( ) ) ;
686+ if let Some ( descr_get) = descr_get {
685687 drop ( mcl) ;
686688 return descr_get ( attr. clone ( ) , None , Some ( zelf. to_owned ( ) . into ( ) ) , vm) ;
687689 }
@@ -745,7 +747,8 @@ impl Callable for PyType {
745747 return Ok ( obj) ;
746748 }
747749
748- if let Some ( init_method) = obj. class ( ) . mro_find_map ( |cls| cls. slots . init . load ( ) ) {
750+ let init = obj. class ( ) . mro_find_map ( |cls| cls. slots . init . load ( ) ) ;
751+ if let Some ( init_method) = init {
749752 init_method ( obj. clone ( ) , args, vm) ?;
750753 }
751754 Ok ( obj)
0 commit comments