Skip to content

Commit decf458

Browse files
Replaced assert in _ctor.py with check and raise
Per issue highlighted by Bandit scanner, replaced assert of isinstance, with a check followed by raise TypeError should it fail
1 parent c10cad8 commit decf458

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

dpctl/tensor/_ctors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ def _array_info_dispatch(obj):
6767

6868

6969
def _array_info_sequence(li):
70-
assert isinstance(li, (list, tuple, range))
70+
if not isinstance(li, (list, tuple, range)):
71+
raise TypeError(f"Expected list, tuple, or range, got {type(li)}")
7172
n = len(li)
7273
dim = None
7374
dt = None

0 commit comments

Comments
 (0)