mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Two more patches by Tony Lownds (SF# 1607548).
(1) Combines the code paths for MAKE_FUNCTION and MAKE_CLOSURE. Fixes a crash where functions with closures and either annotations or keyword-only arguments result in MAKE_CLOSURE, but only MAKE_FUNCTION has the code to handle annotations or keyword-only arguments. Includes enough tests to trigger the bug. (2) Change peepholer to not bail in the presence of EXTENDED_ARG + MAKE_FUNCTION. Enforce the natural 16-bit limit of annotations in compile.c. Also update Misc/NEWS with the "input = raw_input" change.
This commit is contained in:
parent
f74225d63b
commit
0240b92a6c
7 changed files with 68 additions and 38 deletions
|
@ -195,6 +195,14 @@ class TestTranforms(unittest.TestCase):
|
|||
# There should be one jump for the while loop.
|
||||
self.assertEqual(asm.split().count('JUMP_ABSOLUTE'), 1)
|
||||
self.assertEqual(asm.split().count('RETURN_VALUE'), 2)
|
||||
|
||||
def test_make_function_doesnt_bail(self):
|
||||
def f():
|
||||
def g()->1+1:
|
||||
pass
|
||||
return g
|
||||
asm = disassemble(f)
|
||||
self.assert_('BINARY_ADD' not in asm)
|
||||
|
||||
|
||||
def test_main(verbose=None):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue