Skip to content

Commit 12755dc

Browse files
committed
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 <[email protected]>
1 parent 675e056 commit 12755dc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/basics/fun_callstardblstar.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,12 @@ def f(self, a, b, c, d):
2525
eval("a.f(**{'a': 1}, *(2, 3, 4))")
2626
except SyntaxError:
2727
print("SyntaxError")
28+
29+
30+
# coverage test for arg allocation corner case
31+
32+
def f2(*args, **kwargs):
33+
print(len(args), len(kwargs))
34+
35+
36+
f2(*iter(range(4)), **{'a': 1})

0 commit comments

Comments
 (0)