diff options
Diffstat (limited to 'python/databuffer.py')
| -rw-r--r-- | python/databuffer.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/python/databuffer.py b/python/databuffer.py index fea7bb82..df16cc54 100644 --- a/python/databuffer.py +++ b/python/databuffer.py @@ -36,7 +36,8 @@ class DataBuffer: elif isinstance(contents, str): self.handle = core.BNCreateDataBuffer(contents.encode("utf-8"), len(contents.encode("utf-8"))) else: - assert isinstance(contents, bytes) + if not isinstance(contents, bytes): + raise TypeError(f"type {type(contents)} not convertable to DataBuffer") self.handle = core.BNCreateDataBuffer(contents, len(contents)) def __del__(self): |
