threads and exception in wxPython

Thomas Heller theller at python.net
Wed Nov 3 21:45:13 CET 2004


Peter Hansen <peter at engcorp.com> writes:

> Thomas Heller wrote:
>> # raise exception in thread
>> print pythonapi.PyThreadState_SetAsyncExc(t, id(exc))
>
> I should note for the record that neither Thomas'
> example above nor even my more complex one
> (posted earlier, but unfortunately messed up on
> my news server so I can't reply to it), implements
> the required API fully.
>
> The docs for that function say that you should check
> the return value, and if it returns a value greater
> than 1, you must call it again with a NULL as the
> second argument (anyone know if None would be
> okay when using ctypes?), or you probably risk screwing
> up even more than this messy way of killing a
> thread will screw things up normally.

Correct.

And yes, None is the ctypes way to spell NULL (although it would accept
the interger 0 as well).

Thomas



More information about the Python-list mailing list