Skip to content

Commit 7a99639

Browse files
committed
py: Fix function calls that have positional and a star-arg-with-iterator.
Addresses issue adafruit#1678.
1 parent b4eccfd commit 7a99639

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

py/runtime.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@ void mp_call_prepare_args_n_kw_var(bool have_self, mp_uint_t n_args_n_kw, const
671671

672672
// copy the fixed position args
673673
mp_seq_copy(args2 + args2_len, args, n_args, mp_obj_t);
674+
args2_len += n_args;
674675

675676
// extract the variable position args from the iterator
676677
mp_obj_t iterable = mp_getiter(pos_seq);

tests/basics/fun_callstar.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ def foo(a, b, c):
1414
# Iterator
1515
foo(*range(3))
1616

17+
# pos then iterator
18+
foo(1, *range(2, 4))
19+
1720
# method calls with *pos
1821

1922
class A:

0 commit comments

Comments
 (0)