mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
bpo-45636: Merge all numeric operators (GH-29482)
This commit is contained in:
parent
1cbaa505d0
commit
9178f533ff
16 changed files with 613 additions and 1081 deletions
|
@ -7,6 +7,7 @@ import io
|
|||
|
||||
from opcode import *
|
||||
from opcode import __all__ as _opcodes_all
|
||||
from opcode import _nb_ops
|
||||
|
||||
__all__ = ["code_info", "dis", "disassemble", "distb", "disco",
|
||||
"findlinestarts", "findlabels", "show_code",
|
||||
|
@ -27,6 +28,7 @@ MAKE_FUNCTION = opmap['MAKE_FUNCTION']
|
|||
MAKE_FUNCTION_FLAGS = ('defaults', 'kwdefaults', 'annotations', 'closure')
|
||||
|
||||
LOAD_CONST = opmap['LOAD_CONST']
|
||||
BINARY_OP = opmap['BINARY_OP']
|
||||
|
||||
def _try_compile(source, name):
|
||||
"""Attempts to compile the given source, first as an expression and
|
||||
|
@ -446,6 +448,8 @@ def _get_instructions_bytes(code, varname_from_oparg=None,
|
|||
elif op == MAKE_FUNCTION:
|
||||
argrepr = ', '.join(s for i, s in enumerate(MAKE_FUNCTION_FLAGS)
|
||||
if arg & (1<<i))
|
||||
elif op == BINARY_OP:
|
||||
_, argrepr = _nb_ops[arg]
|
||||
yield Instruction(opname[op], op,
|
||||
arg, argval, argrepr,
|
||||
offset, starts_line, is_jump_target, positions)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue