Skip to content

Commit 6d20704

Browse files
ikonstAlexWaygood
andauthored
empty generator *functions*
Co-authored-by: Alex Waygood <[email protected]>
1 parent a64254c commit 6d20704

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mypy/checker.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,8 +1235,9 @@ def check_func_def(
12351235
new_frame.types[key] = narrowed_type
12361236
self.binder.declarations[key] = old_binder.declarations[key]
12371237
with self.scope.push_function(defn):
1238-
# We suppress reachability warnings for empty generators (return; yield), since there's
1239-
# no way to promote a function into a generator except by adding an "unreachable" yield.
1238+
# We suppress reachability warnings for empty generator functions
1239+
# (return; yield), since the most idiomatic way to promote a function into a
1240+
# generator function is often to add an "unreachable" yield.
12401241
#
12411242
# We also suppress reachability warnings when we use TypeVars with value
12421243
# restrictions: we only want to report a warning if a certain statement is

0 commit comments

Comments
 (0)