Skip to content

Commit 0b9d3ce

Browse files
Improve body check: move to condition for better clarity
1 parent 949195e commit 0b9d3ce

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

mypy/checker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,13 +1637,13 @@ def is_unannotated_any(t: Type) -> bool:
16371637
and not defn.is_generator
16381638
and not defn.is_coroutine
16391639
and not self.dynamic_funcs[-1]
1640+
and item.body is not None
16401641
):
16411642
# Collect return types from return statements
16421643
# Use the master type map (first in stack) where final types are stored
16431644
# At this point in type checking, return statement types should be in the master map
16441645
finder = ReturnTypeFinder(self._type_maps[0])
1645-
if item.body:
1646-
item.body.accept(finder)
1646+
item.body.accept(finder)
16471647
return_types_list = finder.return_types
16481648

16491649
if return_types_list:

0 commit comments

Comments
 (0)