javaclass

Changeset

94:89cf6f5868da
2005-01-09 Paul Boddie raw files shortlog changelog graph Added Python 2.2 dis module compatibility.
bytecode.py (file)
     1.1 --- a/bytecode.py	Sat Jan 08 23:52:33 2005 +0100
     1.2 +++ b/bytecode.py	Sun Jan 09 01:36:06 2005 +0100
     1.3 @@ -8,7 +8,14 @@
     1.4  """
     1.5  
     1.6  import classfile
     1.7 -from dis import opmap, cmp_op # for access to Python bytecode values and operators
     1.8 +from dis import cmp_op # for access to Python bytecode values and operators
     1.9 +try:
    1.10 +    from dis import opmap
    1.11 +except ImportError:
    1.12 +    from dis import opname
    1.13 +    opmap = {}
    1.14 +    for i in range(0, len(opname)):
    1.15 +        opmap[opname[i]] = i
    1.16  from UserDict import UserDict
    1.17  import new
    1.18