This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients amaury.forgeotdarc, pitrou, rotem_yaari, theller
Date 2009-10-18.18:19:08
SpamBayes Score 0.00010931141
Marked as misclassified No
Message-id <1255889950.86.0.40457131048.issue1779233@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2009-10-18 18:19:11pitrousetrecipients: + pitrou, theller, amaury.forgeotdarc, rotem_yaari
2009-10-18 18:19:10pitrousetmessageid: <1255889950.86.0.40457131048.issue1779233@psf.upfronthosting.co.za>
2009-10-18 18:19:09pitroulinkissue1779233 messages
2009-10-18 18:19:09pitroucreate