From 245f503ad9ead9257f7d4b8932a86fa9064b5b59 Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Tue, 22 Jan 2019 00:50:03 -0500 Subject: fixes #1253 by handling bytes and strings for find_next_data --- python/binaryview.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'python/binaryview.py') diff --git a/python/binaryview.py b/python/binaryview.py index 2386ff47..951b3f09 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -1963,8 +1963,12 @@ class BinaryView(object): 'AAAA' """ if not isinstance(data, bytes): - raise TypeError("Must be bytes") - buf = databuffer.DataBuffer(data) + if isinstance(data, str): + buf = databuffer.DataBuffer(data.encode()) + else: + raise TypeError("Must be bytes or str") + else: + buf = databuffer.DataBuffer(data) return core.BNWriteViewBuffer(self.handle, addr, buf.handle) def insert(self, addr, data): -- cgit v1.3.1