Skip to content

Commit ebc1cfa

Browse files
author
Ilya Priven
committed
less walrus
1 parent 5e33f47 commit ebc1cfa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mypy/checker.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6970,8 +6970,9 @@ def _is_empty_generator(func: FuncItem) -> bool:
69706970
Checks whether a function's body is 'return; yield' (the yield being added only
69716971
to promote the function into a generator).
69726972
"""
6973+
body = func.body.body
69736974
return (
6974-
len(body := func.body.body) == 2
6975+
len(body) == 2
69756976
and isinstance(ret_stmt := body[0], ReturnStmt)
69766977
and (ret_stmt.expr is None or is_literal_none(ret_stmt.expr))
69776978
and isinstance(expr_stmt := body[1], ExpressionStmt)

0 commit comments

Comments
 (0)