Commits

Armin Rigo  committed 1f11f92

Remove the 'from stdlib_opcode import bytecode_spec' from this file.

  • Participants
  • Parent commits bd749c8

Comments (0)

Files changed (1)

File pypy/objspace/flow/test/test_objspace.py

 from pypy.objspace.flow.objspace import FlowObjSpace
 from pypy.objspace.flow.flowcontext import FlowingError, FlowSpaceFrame
 from pypy import conftest
-from pypy.tool.stdlib_opcode import bytecode_spec, host_bytecode_spec
+from pypy.tool.stdlib_opcode import host_bytecode_spec
 
 import os
 import operator
 is_operator = getattr(operator, 'is_', operator.eq) # it's not there 2.2
 
 @contextmanager
-def patching_opcodes(*opcodes):
+def patching_opcodes(**opcodes):
     meth_names = host_bytecode_spec.method_names
-    opnums = [bytecode_spec.opmap[name] for name in opcodes]
     old_name = {}
-    for name, num in zip(opcodes, opnums):
+    for name, num in opcodes.items():
         old_name[num] = meth_names[num]
         meth_names[num] = name
     yield
         """ Tests code generated by pypy-c compiled with CALL_METHOD
         bytecode
         """
-        with patching_opcodes('CALL_METHOD', 'LOOKUP_METHOD'):
+        with patching_opcodes(CALL_METHOD=202, LOOKUP_METHOD=201):
             class X:
                 def m(self):
                     return 3
         """ Tests code generated by pypy-c compiled with BUILD_LIST_FROM_ARG
         bytecode
         """
-        with patching_opcodes('BUILD_LIST_FROM_ARG'):
+        with patching_opcodes(BUILD_LIST_FROM_ARG=203):
             def f():
                 return [i for i in "abc"]