Fix Python<=2.7.6 "TypeError: Struct() argument 1 must be string, not unicode" (#336)

* Fix Python<=2.7.6 "TypeError: Struct() argument 1 must be string, not unicode"

Additional information is available here: http://python-future.org/stdlib_incompatibilities.html#struct-pack

* Completely remove libheap, as it is not ever referenced
pull/339/head
Zach Riggle 8 years ago committed by Disconnect3d
parent be3c32c29f
commit abad5efeb2

@ -60,6 +60,10 @@ def update():
(8, 'big'): '>Q', (8, 'big'): '>Q',
}.get((m.ptrsize, m.endian)) }.get((m.ptrsize, m.endian))
# Work around Python 2.7.6 struct.pack / unicode incompatibility
# See https://github.com/pwndbg/pwndbg/pull/336 for more information.
m.fmt = str(m.fmt)
# Attempt to detect the qemu-user binary name # Attempt to detect the qemu-user binary name
if m.current == 'arm' and m.endian == 'big': if m.current == 'arm' and m.endian == 'big':
m.qemu = 'armeb' m.qemu = 'armeb'

@ -118,6 +118,10 @@ def search(type, hex, string, executable, writable, value, mapping_name, save, n
'qword': 'Q' 'qword': 'Q'
}[type] }[type]
# Work around Python 2.7.6 struct.pack / unicode incompatibility
# See https://github.com/pwndbg/pwndbg/pull/336 for more information.
fmt = str(fmt)
try: try:
value = struct.pack(fmt, value) value = struct.pack(fmt, value)
except struct.error as e: except struct.error as e:

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save