summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2011-11-04 21:17:45 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2011-11-04 21:17:45 (GMT)
commit97c1bef6a4f3c522826386480c62ec27fe46301d (patch)
treead74de7776f27145f7341dfe24ca961e5267603d /Lib/test
parent3c85fe07f40a18d9f5733e85b213a6992c5b2ed4 (diff)
downloadcpython-97c1bef6a4f3c522826386480c62ec27fe46301d.zip
cpython-97c1bef6a4f3c522826386480c62ec27fe46301d.tar.gz
cpython-97c1bef6a4f3c522826386480c62ec27fe46301d.tar.bz2
Issue #13343: Fix a SystemError when a lambda expression uses a global
variable in the default value of a keyword-only argument: (lambda *, arg=GLOBAL_NAME: None)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_keywordonlyarg.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_keywordonlyarg.py b/Lib/test/test_keywordonlyarg.py
index d7f7541..3aebd68 100644
--- a/Lib/test/test_keywordonlyarg.py
+++ b/Lib/test/test_keywordonlyarg.py
@@ -162,6 +162,14 @@ class KeywordOnlyArgTestCase(unittest.TestCase):
self.assertEqual(Example.f(Example(), k1=1, k2=2), (1, 2))
self.assertRaises(TypeError, Example.f, k1=1, k2=2)
+ def test_issue13343(self):
+ # The Python compiler must scan all symbols of a function to
+ # determine their scope: global, local, cell...
+ # This was not done for the default values of keyword
+ # arguments in a lambda definition, and the following line
+ # used to fail with a SystemError.
+ lambda *, k1=unittest: None
+
def test_main():
run_unittest(KeywordOnlyArgTestCase)