mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-46329: Split calls into precall and call instructions. (GH-30855)
* Add PRECALL_FUNCTION opcode. * Move 'call shape' varaibles into struct. * Replace CALL_NO_KW and CALL_KW with KW_NAMES and CALL instructions. * Specialize for builtin methods taking using the METH_FASTCALL | METH_KEYWORDS protocol. * Allow kwnames for specialized calls to builtin types. * Specialize calls to tuple(arg) and str(arg).
This commit is contained in:
parent
5a9e423473
commit
89fd7c3452
16 changed files with 957 additions and 674 deletions
|
@ -837,9 +837,8 @@ if 1:
|
|||
opcodes = list(dis.get_instructions(func))
|
||||
instructions = [opcode.opname for opcode in opcodes]
|
||||
self.assertNotIn('LOAD_METHOD', instructions)
|
||||
self.assertNotIn('CALL_METHOD', instructions)
|
||||
self.assertIn('LOAD_ATTR', instructions)
|
||||
self.assertIn('CALL_NO_KW', instructions)
|
||||
self.assertIn('PRECALL_FUNCTION', instructions)
|
||||
|
||||
def test_lineno_procedure_call(self):
|
||||
def call():
|
||||
|
@ -1096,7 +1095,7 @@ f(
|
|||
)
|
||||
"""
|
||||
compiled_code, _ = self.check_positions_against_ast(snippet)
|
||||
self.assertOpcodeSourcePositionIs(compiled_code, 'CALL_NO_KW',
|
||||
self.assertOpcodeSourcePositionIs(compiled_code, 'CALL',
|
||||
line=1, end_line=3, column=0, end_column=1)
|
||||
|
||||
def test_very_long_line_end_offset(self):
|
||||
|
@ -1106,7 +1105,7 @@ f(
|
|||
snippet = f"g('{long_string}')"
|
||||
|
||||
compiled_code, _ = self.check_positions_against_ast(snippet)
|
||||
self.assertOpcodeSourcePositionIs(compiled_code, 'CALL_NO_KW',
|
||||
self.assertOpcodeSourcePositionIs(compiled_code, 'CALL',
|
||||
line=1, end_line=1, column=None, end_column=None)
|
||||
|
||||
def test_complex_single_line_expression(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue