diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2007-11-24 00:29:24 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2007-11-24 00:29:24 (GMT) |
commit | e670bd4f636d8a66a55e44b5e368cd2efd1c645c (patch) | |
tree | 1b26c744f305601ab123d4100fc0573e506869a3 /Lib | |
parent | 2af1d894e3e8fea6b84b4229ef15be8d422b718d (diff) | |
download | cpython-e670bd4f636d8a66a55e44b5e368cd2efd1c645c.zip cpython-e670bd4f636d8a66a55e44b5e368cd2efd1c645c.tar.gz cpython-e670bd4f636d8a66a55e44b5e368cd2efd1c645c.tar.bz2 |
fix #1409: cell variables were not initialized,
when the value comes from a keyword-only parameter.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_scope.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_scope.py b/Lib/test/test_scope.py index 22f254a..ccb9016 100644 --- a/Lib/test/test_scope.py +++ b/Lib/test/test_scope.py @@ -166,6 +166,17 @@ class ScopeTests(unittest.TestCase): self.assertEqual(t.method_and_var(), "method") self.assertEqual(t.actual_global(), "global") + def testCellIsKwonlyArg(self): + # Issue 1409: Initialisation of a cell value, + # when it comes from a keyword-only parameter + def foo(*, a=17): + def bar(): + return a + 5 + return bar() + 3 + + self.assertEqual(foo(a=42), 50) + self.assertEqual(foo(), 25) + def testRecursion(self): def f(x): |