Author: Amaury Forgeot d'Arc <[email protected]>
Branch: 
Changeset: r60623:5ab94dfe5b22
Date: 2013-01-28 19:53 +0100
http://bitbucket.org/pypy/pypy/changeset/5ab94dfe5b22/

Log:    Slice opcodes don't exist in py3k anymore. Use a more generic method
        to convert "SLICE+0" to identifiers.

diff --git a/rpython/tool/stdlib_opcode.py b/rpython/tool/stdlib_opcode.py
--- a/rpython/tool/stdlib_opcode.py
+++ b/rpython/tool/stdlib_opcode.py
@@ -71,10 +71,14 @@
     
     def to_globals(self, globals_dict):
         """NOT_RPYTHON. Add individual opcodes to the module constants."""
-        globals_dict.update(self.opmap)
-        globals_dict['SLICE'] = self.opmap["SLICE+0"]
-        globals_dict['STORE_SLICE'] = self.opmap["STORE_SLICE+0"]
-        globals_dict['DELETE_SLICE'] = self.opmap["DELETE_SLICE+0"]
+        for name, value in self.opmap.iteritems():
+            # Rename 'STORE_SLICE+0' opcodes
+            if name.endswith('+0'):
+                name = name[:-2]
+            # Ignore 'STORE_SLICE+1' opcodes
+            elif name.endswith(('+1', '+2', '+3')):
+                continue
+            globals_dict[name] = value
 
     def __str__(self):
         return "<%s bytecode>" % (self.name,)
@@ -83,4 +87,4 @@
 
 from opcode import opmap, HAVE_ARGUMENT
 
-host_bytecode_spec = BytecodeSpec('host', opmap, HAVE_ARGUMENT)
\ No newline at end of file
+host_bytecode_spec = BytecodeSpec('host', opmap, HAVE_ARGUMENT)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to