fix python2/3 incompatibility
bytes built-in is different in python2
This commit is contained in:
parent
fea82991c3
commit
1d735e49d2
1 changed files with 7 additions and 2 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import sys
|
||||
|
||||
import llvm
|
||||
if llvm.version < (3, 4):
|
||||
raise Exception("mc is not supported for llvm version less than 3.4")
|
||||
|
|
@ -129,8 +131,11 @@ class Disassembler(object):
|
|||
@bs)
|
||||
'''
|
||||
|
||||
if isinstance(bs, str):
|
||||
bs = bytes(map(lambda c: ord(c), bs))
|
||||
if not isinstance(bs, bytes):
|
||||
if sys.version_info.major < 3:
|
||||
bs = bytes(bs)
|
||||
else:
|
||||
bs = bytes(map(lambda c: ord(c), bs))
|
||||
|
||||
code = api.llvm.StringRefMemoryObject.new(bs, base_addr)
|
||||
idx = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue