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.
This commit is contained in:
Mark Shannon 2020-01-14 10:12:45 +00:00 committed by GitHub
parent 62e3973395
commit 9af0e47b17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 4909 additions and 4855 deletions

View file

@ -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