[Python-ideas] Thread stopping

Tim Lesher tlesher at gmail.com
Fri Mar 30 14:02:23 CEST 2012


On Fri, Mar 30, 2012 at 06:09, Serhiy Storchaka <storchaka at gmail.com> wrote:
> P. S. I've had a crazy idea. What if we allow to raise any exception, not
> only ThreadInterruptionError, in another thread?

Technically you can already do this, but only from C (i.e., from an
extension or from the interpreter itself). See
PyThreadState_SetAsyncExc().

We do this in our software (which embeds Python in a C program) to
raise SystemExit in Python-launched threads before finalizing the
interpreter.


-- 
Tim Lesher <tlesher at gmail.com>



More information about the Python-ideas mailing list