better errors
This commit is contained in:
@ -12,12 +12,12 @@ def killthread(thread, exc=KeyboardInterrupt):
|
|||||||
|
|
||||||
res = set_async_exc(ident, exc)
|
res = set_async_exc(ident, exc)
|
||||||
if res == 0:
|
if res == 0:
|
||||||
raise ValueError("thread id does not exist")
|
raise ValueError(f"thread {thread} does not exist")
|
||||||
elif res > 1:
|
elif res > 1:
|
||||||
# if return value is greater than one, you are in trouble.
|
# if return value is greater than one, you are in trouble.
|
||||||
# you should call it again with exc=NULL to revert the effect.
|
# you should call it again with exc=NULL to revert the effect.
|
||||||
set_async_exc(ident, None)
|
set_async_exc(ident, None)
|
||||||
raise SystemError("PyThreadState_SetAsyncExc failed")
|
raise SystemError(f"PyThreadState_SetAsyncExc on thread {thread} failed with return value {res}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user