Author David.Manowitz
Recipients David.Manowitz, docs@python, ggenellina, jgehrcke, pitrou, stutzbach, terry.reedy
Date 2012-03-26.17:40:32
SpamBayes Score 5.2889e-11
Marked as misclassified No
Message-id <CABr2X-as931QKF21zu7i7rFNFkRThKxbfHiUWL7tNh78KHA6Mg@mail.gmail.com>
In-reply-to <1332586072.39.0.983087451163.issue6634@psf.upfronthosting.co.za>
Content
I have a couple of issues with that argument:

1.) Until fairly recently, the fact that sys.exit() when called from a
non-primary thread only causes the thread to die, was not clearly
documented (and still isn't in the python2.6 docs).  Admittedly,
thread.exit() does say that it raises the SystemExit exception, but as most
people are encouraged to use the *threading* module, rather than the
*thread* module directly, this is still fairly obscure.

2.) A ThreadExit exception could be derived from the SystemExit exception,
so existing code that works by catching a SystemExit exception would still
work.

--David

On Sat, Mar 24, 2012 at 6:47 AM, Antoine Pitrou <report@bugs.python.org>wrote:

>
> Antoine Pitrou <pitrou@free.fr> added the comment:
>
> > I don't see why this should be considered acceptable behavior.  Why
> > don't threads have their own ThreadExit exception, rather than
> > overloading the use, and therefore, the meaning, of the SystemExit
> > exception?  As indicated by their names, sys.exit and the SystemExit
> > exception should *only* be used to exit the entire system, not just a
> > thread!
>
> I agree the situation isn't optimal. However, fixing this would also break
> compatibility with any application that uses sys.exit() in a thread and
> expects it to exit the thread, not the whole process. So we're kind of
> stuck with it.
>
> ----------
> nosy: +pitrou
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue6634>
> _______________________________________
>
History
Date User Action Args
2012-03-26 17:40:33David.Manowitzsetrecipients: + David.Manowitz, terry.reedy, ggenellina, pitrou, stutzbach, jgehrcke, docs@python
2012-03-26 17:40:32David.Manowitzlinkissue6634 messages
2012-03-26 17:40:32David.Manowitzcreate