Python 3 compatibility fix

pull/2/head
Bernhard Mueller 7 years ago
parent 5f75257cea
commit 6be089c9b7
  1. 8
      ether/asm.py

@ -1,4 +1,5 @@
from ethereum import opcodes
import codecs
import re
import binascii
@ -8,9 +9,10 @@ regex_PUSH = re.compile('^PUSH(\d*)$')
def safe_decode(hex_encoded_string):
if (hex_encoded_string.startswith("0x")):
return hex_encoded_string[2:].decode("hex")
return codecs.decode(hex_encoded_string[2:], 'hex_codec')
else:
return hex_encoded_string.decode("hex")
return codecs.decode(hex_encoded_string, 'hex_codec')
def disassembly_to_easm(disassembly):
@ -131,7 +133,7 @@ def disassemble(encoded_bytecode):
if m:
argument = bytecode[i+1:i+1+int(m.group(1))]
instruction['argument'] = argument.encode("hex")
instruction['argument'] = codecs.encode(argument, "hex_codec")
i += int(m.group(1))
disassembly.append(instruction)

Loading…
Cancel
Save