Script execution

This commit is contained in:
2022-08-29 17:22:47 +02:00
parent ae034f6c66
commit dc13993441

View File

@@ -1,6 +1,7 @@
import ctypes
def ctype_async_raise(target_tid, exception):
ret = ctypes.pythonapi.PyThreadState_SetAsyncExc(ctypes.c_long(target_tid), ctypes.py_object(exception))
def ctype_async_raise(thread, exception):
tid=thread.ident
ret = ctypes.pythonapi.PyThreadState_SetAsyncExc(ctypes.c_long(tid), ctypes.py_object(exception))
# ref: http://docs.python.org/c-api/init.html#PyThreadState_SetAsyncExc
if ret == 0:
raise ValueError("Invalid thread ID")