@@ -870,16 +870,8 @@ def verify_funcitem(
870
870
return
871
871
872
872
if isinstance (stub , nodes .FuncDef ):
873
- stub_abstract = stub .abstract_status == nodes .IS_ABSTRACT
874
- runtime_abstract = getattr (runtime , "__isabstractmethod__" , False )
875
- # The opposite can exist: some implementations omit `@abstractmethod` decorators
876
- if runtime_abstract and not stub_abstract :
877
- yield Error (
878
- object_path ,
879
- "is inconsistent, runtime method is abstract but stub is not" ,
880
- stub ,
881
- runtime ,
882
- )
873
+ for error_text in _verify_abstract_status (stub , runtime ):
874
+ yield Error (object_path , error_text , stub , runtime )
883
875
884
876
for message in _verify_static_class_methods (stub , runtime , object_path ):
885
877
yield Error (object_path , "is inconsistent, " + message , stub , runtime )
@@ -1066,6 +1058,15 @@ def _verify_readonly_property(stub: nodes.Decorator, runtime: Any) -> Iterator[s
1066
1058
yield "is inconsistent, cannot reconcile @property on stub with runtime object"
1067
1059
1068
1060
1061
+ def _verify_abstract_status (stub : nodes .FuncDef , runtime : Any ) -> Iterator [str ]:
1062
+ stub_abstract = stub .abstract_status == nodes .IS_ABSTRACT
1063
+ runtime_abstract = getattr (runtime , "__isabstractmethod__" , False )
1064
+ # The opposite can exist: some implementations omit `@abstractmethod` decorators
1065
+ if runtime_abstract and not stub_abstract :
1066
+ item_type = "property" if stub .is_property else "method"
1067
+ yield f"is inconsistent, runtime { item_type } is abstract but stub is not"
1068
+
1069
+
1069
1070
def _resolve_funcitem_from_decorator (dec : nodes .OverloadPart ) -> nodes .FuncItem | None :
1070
1071
"""Returns a FuncItem that corresponds to the output of the decorator.
1071
1072
@@ -1124,6 +1125,8 @@ def verify_decorator(
1124
1125
if stub .func .is_property :
1125
1126
for message in _verify_readonly_property (stub , runtime ):
1126
1127
yield Error (object_path , message , stub , runtime )
1128
+ for message in _verify_abstract_status (stub .func , runtime ):
1129
+ yield Error (object_path , message , stub , runtime )
1127
1130
return
1128
1131
1129
1132
func = _resolve_funcitem_from_decorator (stub )
0 commit comments