summaryrefslogtreecommitdiffstats
path: root/Lib/opcode.py
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2020-01-14 10:12:45 (GMT)
committerGitHub <noreply@github.com>2020-01-14 10:12:45 (GMT)
commit9af0e47b1705457bb6b327c197f2ec5737a1d8f6 (patch)
tree97378eee78d793d16bd19038d88371d776e720c3 /Lib/opcode.py
parent62e3973395fb9fab2eb8f651bcd0fea4e695e1cf (diff)
downloadcpython-9af0e47b1705457bb6b327c197f2ec5737a1d8f6.zip
cpython-9af0e47b1705457bb6b327c197f2ec5737a1d8f6.tar.gz
cpython-9af0e47b1705457bb6b327c197f2ec5737a1d8f6.tar.bz2
bpo-39156: Break up COMPARE_OP into four logically distinct opcodes. (GH-17754)
Break up COMPARE_OP into four logically distinct opcodes: * COMPARE_OP for rich comparisons * IS_OP for 'is' and 'is not' tests * CONTAINS_OP for 'in' and 'is not' tests * JUMP_IF_NOT_EXC_MATCH for checking exceptions in 'try-except' statements.
Diffstat (limited to 'Lib/opcode.py')
-rw-r--r--Lib/opcode.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/opcode.py b/Lib/opcode.py
index 1898a38..e31563b 100644
--- a/Lib/opcode.py
+++ b/Lib/opcode.py
@@ -21,8 +21,7 @@ try:
except ImportError:
pass
-cmp_op = ('<', '<=', '==', '!=', '>', '>=', 'in', 'not in', 'is',
- 'is not', 'exception match', 'BAD')
+cmp_op = ('<', '<=', '==', '!=', '>', '>=')
hasconst = []
hasname = []
@@ -159,6 +158,10 @@ jabs_op('POP_JUMP_IF_TRUE', 115) # ""
name_op('LOAD_GLOBAL', 116) # Index in name list
+def_op('IS_OP', 117)
+def_op('CONTAINS_OP', 118)
+
+jabs_op('JUMP_IF_NOT_EXC_MATCH', 121)
jrel_op('SETUP_FINALLY', 122) # Distance to target address
def_op('LOAD_FAST', 124) # Local variable number