Antoine Pitrou <pit...@free.fr> added the comment: The following works (2.6 and trunk):
import ctypes, thread ctypes.pythonapi.PyThreadState_SetAsyncExc( ctypes.c_long(thread.get_ident()), ctypes.py_object(ZeroDivisionError)) for i in range(1000): pass The thing to remember is that PyThreadState_SetAsyncExc() is asynchronous and doesn't guarantee that the exception will be raised timely (that's why I added a small busy loop above). ---------- nosy: +pitrou _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue1779233> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com