[issue1156] Suggested change to _exit function description in os module documentation

Guido van Rossum report at bugs.python.org
Fri Sep 14 21:40:49 CEST 2007


Guido van Rossum added the comment:

> Should "child" be replaced with "parent"?

No.  I'm pretty much I wrote that.  The use case I was thinking of is
the error handling in the child process after the exec fails.  if you
were to use sys.exit() there, which raises SystemExit, you're likely to
hit various exception handlers that were set up in the parent, and you
even run the risk of some main loop continuing *in the child*.  I've had
many a program produce the phenomenon of "double tracebacks" due to this
mistake.

OTOH, in the parent, if you want to exit after forking (e.g. to create a
parent-less daemon process), a regular sys.exit() is usually just fine,
as any exception handlers you might trigger were meant to be triggered.

----------
nosy: +gvanrossum
resolution:  -> rejected
status: open -> closed

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1156>
__________________________________


More information about the Python-bugs-list mailing list