diff options
author | Benjamin Peterson <benjamin@python.org> | 2013-02-10 14:48:22 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2013-02-10 14:48:22 (GMT) |
commit | 419d9a83d5688940b3dbb410029080ad7f2f71a8 (patch) | |
tree | 2608b28d9ba829e1c533a27bfa645ba94f478291 /Lib | |
parent | 8b466c99329c0d422a48acfae0c20ec1e76ef314 (diff) | |
download | cpython-419d9a83d5688940b3dbb410029080ad7f2f71a8.zip cpython-419d9a83d5688940b3dbb410029080ad7f2f71a8.tar.gz cpython-419d9a83d5688940b3dbb410029080ad7f2f71a8.tar.bz2 |
evaluate lambda keyword-only defaults after positional defaults (#16967 again)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/importlib/_bootstrap.py | 4 | ||||
-rw-r--r-- | Lib/test/test_keywordonlyarg.py | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index 652d0fd..a75ddfb 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -396,7 +396,7 @@ Known values: 3210 (added size modulo 2**32 to the pyc header) Python 3.3a1 3220 (changed PEP 380 implementation) Python 3.3a4 3230 (revert changes to implicit __class__ closure) - Python 3.4a1 3240 (evaluate positional default arguments before + Python 3.4a1 3250 (evaluate positional default arguments before keyword-only defaults) MAGIC must change whenever the bytecode emitted by the compiler may no @@ -404,7 +404,7 @@ longer be understood by older implementations of the eval loop (usually due to the addition of new opcodes). """ -_RAW_MAGIC_NUMBER = 3240 | ord('\r') << 16 | ord('\n') << 24 +_RAW_MAGIC_NUMBER = 3250 | ord('\r') << 16 | ord('\n') << 24 _MAGIC_BYTES = bytes(_RAW_MAGIC_NUMBER >> n & 0xff for n in range(0, 25, 8)) _PYCACHE = '__pycache__' diff --git a/Lib/test/test_keywordonlyarg.py b/Lib/test/test_keywordonlyarg.py index 7aabdfc..f0580d3 100644 --- a/Lib/test/test_keywordonlyarg.py +++ b/Lib/test/test_keywordonlyarg.py @@ -183,6 +183,10 @@ class KeywordOnlyArgTestCase(unittest.TestCase): def f(v=a, x=b, *, y=c, z=d): pass self.assertEqual(str(err.exception), "global name 'b' is not defined") + with self.assertRaises(NameError) as err: + f = lambda v=a, x=b, *, y=c, z=d: None + self.assertEqual(str(err.exception), "global name 'b' is not defined") + def test_main(): run_unittest(KeywordOnlyArgTestCase) |