Message94218
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). |
|
Date |
User |
Action |
Args |
2009-10-18 18:19:11 | pitrou | set | recipients:
+ pitrou, theller, amaury.forgeotdarc, rotem_yaari |
2009-10-18 18:19:10 | pitrou | set | messageid: <1255889950.86.0.40457131048.issue1779233@psf.upfronthosting.co.za> |
2009-10-18 18:19:09 | pitrou | link | issue1779233 messages |
2009-10-18 18:19:09 | pitrou | create | |
|