aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDamien George2015-05-06 13:55:33 +0100
committerDamien George2015-05-06 13:55:33 +0100
commit9a42eb541eb426a04bb0541ccf0e26ce82bdcb22 (patch)
tree81cedf06ee028a04124b8bf3fda9a42175bfeee7 /tests
parentcd87d20f4631660e0189371eed7155bfca457ad4 (diff)
py: Fix naming of function arguments when function is a closure.
Addresses issue #1226.
Diffstat (limited to 'tests')
-rw-r--r--tests/basics/closure_namedarg.py9
-rw-r--r--tests/cmdline/cmd_showbc.py.exp10
2 files changed, 14 insertions, 5 deletions
diff --git a/tests/basics/closure_namedarg.py b/tests/basics/closure_namedarg.py
new file mode 100644
index 000000000..5c0c451d1
--- /dev/null
+++ b/tests/basics/closure_namedarg.py
@@ -0,0 +1,9 @@
+# test passing named arg to closed-over function
+
+def f():
+ x = 1
+ def g(z):
+ print(x, z)
+ return g
+
+f()(z=42)
diff --git a/tests/cmdline/cmd_showbc.py.exp b/tests/cmdline/cmd_showbc.py.exp
index 723a403a1..02e367654 100644
--- a/tests/cmdline/cmd_showbc.py.exp
+++ b/tests/cmdline/cmd_showbc.py.exp
@@ -354,7 +354,7 @@ File cmdline/cmd_showbc.py, code block '<genexpr>' (descriptor: \.\+, bytecode @
Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+):
########
\.\+5b
-arg names: c e
+arg names: * * *
(N_STATE 6)
(N_EXC_STACK 0)
bc=-\\d\+ line=1
@@ -373,7 +373,7 @@ File cmdline/cmd_showbc.py, code block '<listcomp>' (descriptor: \.\+, bytecode
Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+):
########
\.\+5b
-arg names: c e
+arg names: * * *
(N_STATE 7)
(N_EXC_STACK 0)
bc=-\\d\+ line=1
@@ -391,7 +391,7 @@ File cmdline/cmd_showbc.py, code block '<dictcomp>' (descriptor: \.\+, bytecode
Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+):
########
\.\+5b
-arg names: c e
+arg names: * * *
(N_STATE 8)
(N_EXC_STACK 0)
bc=-\\d\+ line=1
@@ -411,7 +411,7 @@ File cmdline/cmd_showbc.py, code block 'closure' (descriptor: \.\+, bytecode @\.
Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+):
########
\.\+5b
-arg names: x
+arg names: *
(N_STATE 4)
(N_EXC_STACK 0)
bc=-\\d\+ line=1
@@ -430,7 +430,7 @@ File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ byt
Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+):
########
\.\+5b
-arg names: b a
+arg names: * b
(N_STATE 4)
(N_EXC_STACK 0)
bc=-\\d\+ line=1