Skip to content

Commit 966d52c

Browse files
committed
Simplify attempt at boolean literals to integer literals
1 parent 4e9559a commit 966d52c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

mypy/checker.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5115,14 +5115,11 @@ def visit_for_stmt(self, s: ForStmt) -> None:
51155115
supertype = self.named_type("typing.Generator").type
51165116
super_instance = map_instance_to_supertype(proper_iter_type, supertype)
51175117
if isinstance(get_proper_type(super_instance.args[2]), UninhabitedType):
5118-
exit_condition = NameExpr("True")
5119-
exit_condition.fullname = "builtins.True"
5118+
exit_condition = IntExpr(1)
51205119
else:
5121-
exit_condition = NameExpr("False")
5122-
exit_condition.fullname = "builtins.False"
5120+
exit_condition = IntExpr(0)
51235121
else:
5124-
exit_condition = NameExpr("False")
5125-
exit_condition.fullname = "builtins.False"
5122+
exit_condition = IntExpr(0)
51265123

51275124
self.accept_loop(
51285125
s.body,

0 commit comments

Comments
 (0)