Skip to content

Commit f194ab0

Browse files
committed
Replace runtime assert with explicit TypeError in interrupt handling
Signed-off-by: Arbaaz Ahmed <arbaazahmed419@gmail.com>
1 parent 022ddc8 commit f194ab0

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/scancode/interrupt.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,10 @@ def async_raise(tid, exctype=Exception):
167167
from http://tomerfiliba.com/recipes/Thread2/
168168
license: public domain.
169169
"""
170-
assert isinstance(tid, int), 'Invalid thread id: must an integer'
170+
if not isinstance(tid, int):
171+
raise TypeError(
172+
f"Invalid thread id: must be an integer, got {type(tid).__name__}"
173+
)
171174

172175
tid = c_long(tid)
173176
exception = py_object(Exception)

0 commit comments

Comments
 (0)