sending thread exceptions (was Re: RELEASED Python 2.3.1)

Chris Liechti cliechti at gmx.net
Wed Sep 24 16:41:47 EDT 2003


Peter Hansen <peter at engcorp.com> wrote in
news:3F71B857.2D1E3268 at engcorp.com: 

> Anthony Baxter wrote:
>> 
>> On behalf of the Python development team and the Python community,
>> I'm happy to announce the release of Python 2.3.1 (final).
> 
> The highlights mention the existence of a new API
> PyThreadState_SetAsyncEnc, which is "deliberately accessible only from
> C", that can interrupt a thread by sending it an exception.
> 
> I can't find an online discussion of this, so I'm asking here.  Why
> was this made accessible only from C?  Is it dangerous?  Experimental?
>  Someone feels it will be used inappropriately if too readily
> available at the Python level? 

martellibot has something about it: 
http://www.strakt.com/docs/os03_threads_interrupt.pdf

> Presumably somebody will come up with a little extension module or
> other technique for calling this which will let anyone use it at will,
> so I'm unclear on why it should be made inaccessible from Python.

why bother with c, just use ctypes to call the function ;-)

chris

-- 
Chris <cliechti at gmx.net>





More information about the Python-list mailing list