STORE_FAST_LOAD_FAST = opmap['STORE_FAST_LOAD_FAST']
STORE_FAST_STORE_FAST = opmap['STORE_FAST_STORE_FAST']
IS_OP = opmap['IS_OP']
+CONTAINS_OP = opmap['CONTAINS_OP']
CACHE = opmap["CACHE"]
argrepr = _special_method_names[arg]
elif deop == IS_OP:
argrepr = 'is not' if argval else 'is'
+ elif deop == CONTAINS_OP:
+ argrepr = 'not in' if argval else 'in'
return argval, argrepr
def get_instructions(x, *, first_line=None, show_caches=None, adaptive=False):
dis.dis("a is not b", file=output, show_caches=True)
self.assertIn("IS_OP 1 (is not)", output.getvalue())
+ def test_contains_op_format(self):
+ output = io.StringIO()
+ dis.dis("a in b", file=output, show_caches=True)
+ self.assertIn("CONTAINS_OP 0 (in)", output.getvalue())
+
+ output = io.StringIO()
+ dis.dis("a not in b", file=output, show_caches=True)
+ self.assertIn("CONTAINS_OP 1 (not in)", output.getvalue())
+
def test_baseopname_and_baseopcode(self):
# Standard instructions
for name, code in dis.opmap.items():