threads and exception in wxPython

Peter Hansen peter at engcorp.com
Wed Nov 3 15:46:31 EST 2004


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.

-Peter



More information about the Python-list mailing list