Skip to content

Commit 4768518

Browse files
dlechdpgeorge
authored andcommitted
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>
1 parent 9b74d71 commit 4768518

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy