From f8186c868eba120e8fa87eb8138ffdc52c1dfa16 Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Wed, 19 Jan 2022 10:52:34 -0500 Subject: Turn some asserts back into exceptions --- python/databuffer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'python/databuffer.py') 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): -- cgit v1.3.1