summaryrefslogtreecommitdiffstats
path: root/Lib/dis.py
diff options
context:
space:
mode:
authorBrandt Bucher <brandt@python.org>2021-11-11 06:56:22 (GMT)
committerGitHub <noreply@github.com>2021-11-11 06:56:22 (GMT)
commit9178f533ff5ea7462a2ca22cfa67afd78dad433b (patch)
tree2341d2dbc7fbee0585e0d37a04c07b07c8036d57 /Lib/dis.py
parent1cbaa505d007e11c4a1f0d2073d72b6c02c7147c (diff)
downloadcpython-9178f533ff5ea7462a2ca22cfa67afd78dad433b.zip
cpython-9178f533ff5ea7462a2ca22cfa67afd78dad433b.tar.gz
cpython-9178f533ff5ea7462a2ca22cfa67afd78dad433b.tar.bz2
bpo-45636: Merge all numeric operators (GH-29482)
Diffstat (limited to 'Lib/dis.py')
-rw-r--r--Lib/dis.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/dis.py b/Lib/dis.py
index 8b429b5..ac0c6e7 100644
--- a/Lib/dis.py
+++ b/Lib/dis.py
@@ -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)