Python 2 compatibility fix

pull/2/head
Bernhard Mueller 7 years ago
parent 3583d77cb7
commit 02e8eff9e4
  1. 12
      ether/asm.py

@ -1,6 +1,7 @@
from ethereum import opcodes
import codecs
import sys
import re
import codecs
from ethereum import opcodes
regex_PUSH = re.compile('^PUSH(\d*)$')
@ -109,8 +110,13 @@ def disassemble(bytecode):
instruction = {}
try:
opcode = opcodes.opcodes[bytecode[i]]
if (sys.version_info > (3, 0)):
opcode = opcodes.opcodes[bytecode[i]]
else:
opcode = opcodes.opcodes[ord(bytecode[i])]
except KeyError:
# invalid opcode
disassembly.append({'opcode': "INVALID"})
i += 1

Loading…
Cancel
Save