Skip to content

Commit ab766cc

Browse files
committed
Fix detection of decorated function always returning None
1 parent e106dd7 commit ab766cc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

mypy/checkexpr.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,8 @@ def always_returns_none(self, node: Expression) -> bool:
716716

717717
def defn_returns_none(self, defn: SymbolNode | None) -> bool:
718718
"""Check if `defn` can _only_ return None."""
719+
if isinstance(defn, Decorator):
720+
defn = defn.func
719721
if isinstance(defn, FuncDef):
720722
return isinstance(defn.type, CallableType) and isinstance(
721723
get_proper_type(defn.type.ret_type), NoneType

0 commit comments

Comments
 (0)