Issue6634
Created on 2009-08-03 19:21 by jgehrcke, last changed 2009-08-05 00:14 by gagenellina.
| Messages (2) | |||
|---|---|---|---|
| msg91237 - (view) | Author: Jan-Philip Gehrcke (jgehrcke) | Date: 2009-08-03 19:21 | |
Hey there,
hopefully I fill out this form in an adequate way!
I ran into some problems while using sys.exit('msg') together with
threads, which could have been avoided with slightly more information in
the docs here: http://docs.python.org/library/sys.html#sys.exit
Maybe the following two statements should not stay as they are:
(1) "Exit from Python."
-----------------------
This is not true when called from a thread other than the main one. We
could add a hint, saying that sys.exit() then actually behaves like
thread.exit(), which causes only the calling thread to exit, but not the
main program.
2) "[...] and any other object is printed to sys.stderr"
--------------------------------------------------------
This is also not true when called from a thread other than the main one.
Calling sys.exit('msg') then doesn't print anything to stderr. That was
annoying in my case and required debugging a bug that would have
discovered itself via stderr, if the message would have been printed..
:-) After some research, I think this behaviour is described in the
documentation for thread.exit(): "[...] this will cause the thread to
exit *silently*."
Okay, now that I am aware of this behaviour, I won't run into these
problems again. But the next one?
I think (1) is clearly a documentation thing. Regarding (2): first of
all, the documentation should say that the message is suppressed in
special cases (child threads). But: what argues against printing to
stderr here? I don't get the point and only see a lost feature,
affording a quick way to kill a thread while dropping an error message.
Was this kicked out intentionally? Maybe someone could help me with a
good argument here :-)
Thank you for your work,
Jan-Philip Gehrcke
|
|||
| msg91288 - (view) | Author: Gabriel Genellina (gagenellina) | Date: 2009-08-05 00:14 | |
I agree with you; the docs should be improved, and I see no reason for
sys.exit("msg") NOT to write to stderr inside a child thread.
|
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2009-08-05 00:14:48 | gagenellina | set | nosy:
+ gagenellina messages: + msg91288 |
| 2009-08-03 19:21:49 | jgehrcke | create | |