tests/basics/fun_callstardblstar: Add coverage test.

This fixes code coverage for the case where a *arg without __len__ is
unpacked and uses exactly the amount of memory that was allocated for
kw args. This triggers the code branch where the memory for the kw args
gets reallocated since it was used already by the *arg unpacking.

Signed-off-by: David Lechner <david@pybricks.com>
This commit is contained in:
David Lechner 2022-03-29 13:15:15 -05:00 committed by Damien George
parent 9b74d71aa7
commit 47685180f0
1 changed files with 9 additions and 0 deletions

View File

@ -25,3 +25,12 @@ try:
eval("a.f(**{'a': 1}, *(2, 3, 4))")
except SyntaxError:
print("SyntaxError")
# coverage test for arg allocation corner case
def f2(*args, **kwargs):
print(len(args), len(kwargs))
f2(*iter(range(4)), **{'a': 1})