Skip to content

Instantly share code, notes, and snippets.

@nazavode
nazavode / ctype_async_raise.py
Last active August 9, 2023 15:48 — forked from liuw/ctype_async_raise.py
Nasty hack to raise exception for other threads
from __future__ import print_function
import ctypes
import threading
import time
def async_raise(thread_obj, exception):
""" Raises an exception inside an arbitrary active :class:`~threading.Thread`.
Parameters