# HG changeset patch # User Paul Boddie # Date 1105230966 -3600 # Node ID 89cf6f5868da20bd8e2aa201e068e95becbccdf1 # Parent 1df4fc5c93d69cd4f3c8b192d15c6a0fbbc3151b Added Python 2.2 dis module compatibility. diff -r 1df4fc5c93d6 -r 89cf6f5868da bytecode.py --- a/bytecode.py Sat Jan 08 23:52:33 2005 +0100 +++ b/bytecode.py Sun Jan 09 01:36:06 2005 +0100 @@ -8,7 +8,14 @@ """ import classfile -from dis import opmap, cmp_op # for access to Python bytecode values and operators +from dis import cmp_op # for access to Python bytecode values and operators +try: + from dis import opmap +except ImportError: + from dis import opname + opmap = {} + for i in range(0, len(opname)): + opmap[opname[i]] = i from UserDict import UserDict import new