Skip to content

Commit 3ad0bad

Browse files
Update for_helpers.py
1 parent 4fda932 commit 3ad0bad

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mypyc/irbuild/for_helpers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from __future__ import annotations
99

10-
from typing import Callable, ClassVar, cast
10+
from typing import Callable, ClassVar
1111

1212
from mypy.nodes import (
1313
ARG_POS,
@@ -470,7 +470,8 @@ def make_for_loop_generator(
470470
else:
471471
start_reg = builder.accept(expr.args[0])
472472
end_reg = builder.accept(expr.args[1])
473-
step = 1 if num_args == 2 else cast(int, builder.extract_int(expr.args[2]))
473+
step = 1 if num_args == 2 else builder.extract_int(expr.args[2])
474+
assert isinstance(step, int), "this was validated above, the assert is for mypy"
474475

475476
for_range = ForRange(builder, index, body_block, loop_exit, line, nested)
476477
for_range.init(start_reg, end_reg, step)

0 commit comments

Comments
 (0)