[pypy-svn] r33354 - pypy/dist/pypy/interpreter

arigo at codespeak.net arigo at codespeak.net
Tue Oct 17 08:21:42 CEST 2006


Author: arigo
Date: Tue Oct 17 08:21:41 2006
New Revision: 33354

Modified:
   pypy/dist/pypy/interpreter/pyopcode.py
Log:
This was a nice attempt at sorting the opcodes in a predictable order, 
but as far as I can tell it was not sorting them at all.  Try again.  
(Also try to be Python-2.3-friendly).



Modified: pypy/dist/pypy/interpreter/pyopcode.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyopcode.py	(original)
+++ pypy/dist/pypy/interpreter/pyopcode.py	Tue Oct 17 08:21:41 2006
@@ -840,10 +840,11 @@
             except ValueError:
                 index = 1000000
             return index, opcode
-        opcases = [(i, opname) for opname, i in pythonopcode.opmap.iteritems()]
-        opcases.sort(key = sortkey)    # for predictable results
+        opcases = [(sortkey(i), i, opname)
+                   for opname, i in pythonopcode.opmap.iteritems()]
+        opcases.sort()    # for predictable results
 
-        for i, opname in opcases:
+        for _, i, opname in opcases:
             if i == pythonopcode.EXTENDED_ARG or i < pythonopcode.HAVE_ARGUMENT:
                 continue
             opname         = opname.replace('+', '_')
@@ -855,7 +856,7 @@
         dispatch_code +=     '                    self.MISSING_OPCODE_W_ARG(oparg)\n'
         dispatch_code +=     '                break\n'
 
-        for i, opname in opcases:
+        for _, i, opname in opcases:
             if i >= pythonopcode.HAVE_ARGUMENT:
                 continue
             opname         = opname.replace('+', '_')



More information about the Pypy-commit mailing list