From 7a99639cffb4397fa964268433d23b9ef0707892 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 3 Dec 2015 17:59:49 +0000 Subject: [PATCH] py: Fix function calls that have positional and a star-arg-with-iterator. Addresses issue #1678. --- py/runtime.c | 1 + tests/basics/fun_callstar.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/py/runtime.c b/py/runtime.c index e45591bbe2..c6a85bb01e 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -671,6 +671,7 @@ void mp_call_prepare_args_n_kw_var(bool have_self, mp_uint_t n_args_n_kw, const // copy the fixed position args mp_seq_copy(args2 + args2_len, args, n_args, mp_obj_t); + args2_len += n_args; // extract the variable position args from the iterator mp_obj_t iterable = mp_getiter(pos_seq); diff --git a/tests/basics/fun_callstar.py b/tests/basics/fun_callstar.py index 255563b26b..2275d3d4fc 100644 --- a/tests/basics/fun_callstar.py +++ b/tests/basics/fun_callstar.py @@ -14,6 +14,9 @@ foo(1, 2, *[100]) # Iterator foo(*range(3)) +# pos then iterator +foo(1, *range(2, 4)) + # method calls with *pos class A: