diff options
author | David Lechner <david@pybricks.com> | 2022-03-29 13:15:15 -0500 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2022-03-31 17:01:15 +1100 |
commit | 47685180f02254a9d2dfd2eb9dafc24888daeb33 (patch) | |
tree | 0d63bb44a9d7ce93cc0fa50a2a8e2c476b58201c /tests/basics/fun_callstardblstar.py | |
parent | 9b74d71aa74d368e0679616173edb4be49e03684 (diff) | |
download | micropython-47685180f02254a9d2dfd2eb9dafc24888daeb33.tar.gz micropython-47685180f02254a9d2dfd2eb9dafc24888daeb33.zip |
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>
Diffstat (limited to 'tests/basics/fun_callstardblstar.py')
-rw-r--r-- | tests/basics/fun_callstardblstar.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/basics/fun_callstardblstar.py b/tests/basics/fun_callstardblstar.py index aceb04a843..7db458b561 100644 --- a/tests/basics/fun_callstardblstar.py +++ b/tests/basics/fun_callstardblstar.py @@ -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}) |