mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
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:
parent
62e3973395
commit
9af0e47b17
17 changed files with 4909 additions and 4855 deletions
|
|
@ -434,11 +434,11 @@ class PositionalOnlyTestCase(unittest.TestCase):
|
|||
def f(x: not (int is int), /): ...
|
||||
|
||||
# without constant folding we end up with
|
||||
# COMPARE_OP(is), UNARY_NOT
|
||||
# with constant folding we should expect a COMPARE_OP(is not)
|
||||
# COMPARE_OP(is), IS_OP (0)
|
||||
# with constant folding we should expect a IS_OP (1)
|
||||
codes = [(i.opname, i.argval) for i in dis.get_instructions(g)]
|
||||
self.assertNotIn(('UNARY_NOT', None), codes)
|
||||
self.assertIn(('COMPARE_OP', 'is not'), codes)
|
||||
self.assertIn(('IS_OP', 1), codes)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue