diff options
| author | Peter LaFosse <peter@vector35.com> | 2022-01-19 10:52:34 -0500 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2022-01-19 15:20:47 -0500 |
| commit | f8186c868eba120e8fa87eb8138ffdc52c1dfa16 (patch) | |
| tree | c9e3ccca9440875f2ee54c79582ab3da5af0e2c1 /python/databuffer.py | |
| parent | 6f5fd10c589cd7bf525d91a60a0dc66bc4f93e25 (diff) | |
Turn some asserts back into exceptions
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): |
