Skip to content

Commit 280d246

Browse files
committed
Merge branch 'preallocate-helper-rtuple' of https://github.com/BobTheBuidler/mypy into preallocate-helper-rtuple
2 parents c9545a1 + 7883043 commit 280d246

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

mypyc/irbuild/for_helpers.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,16 +236,14 @@ def sequence_from_generator_preallocate_helper(
236236
if not (is_sequence_rprimitive(rtype) or isinstance(rtype, RTuple)):
237237
return None
238238
sequence = builder.accept(sequence_expr)
239-
length = get_expr_length_value(
240-
builder, sequence_expr, sequence, line, use_pyssize_t=True
241-
)
239+
length = get_expr_length_value(builder, sequence_expr, sequence, line, use_pyssize_t=True)
242240
if isinstance(rtype, RTuple):
243241
# If input is RTuple, box it to tuple_rprimitive for generic iteration
244242
# TODO: this can be optimized a bit better with an unrolled ForRTuple helper
245243
sequence = builder.coerce(sequence, tuple_rprimitive, line, force=True)
246244
items = [builder.add(TupleGet(sequence, i, line) for i in range(len(rtype.types)))]
247245
sequence = builder.new_tuple(items, line)
248-
246+
249247
target_op = empty_op_llbuilder(length, line)
250248

251249
def set_item(item_index: Value) -> None:

0 commit comments

Comments
 (0)