This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author OG7
Recipients OG7, grahamd, i000, jnoller, ptn
Date 2009-06-10.15:12:44
SpamBayes Score 2.2636043e-07
Marked as misclassified No
Message-id <1244646766.54.0.00453191291083.issue5313@psf.upfronthosting.co.za>
In-reply-to
Content
Closing the stdin fd without closing the stdin file is very dangerous.
It means that stdin will now access some random resource, for example, a
pipe created with os.pipe().

Closing stdin is useful to let the parent be alone in reading from it.
It can be achieved by replacing stdin by open('/dev/null'). The original
stdin can be closed or left to be garbage collected.

The "double flush" case is impossible to handle in general. It's the
libc's responsibility for standard file objects and sockets. But it
can't be helped (except by putting a warning in the documentation) if
someone combines multiprocessing with non-fork-safe code that keeps its
own buffers and doesn't check for a pid change.

So that code in _bootstrap should be:
sys.stdin.close()
sys.stdin = open(os.devnull)
History
Date User Action Args
2009-06-10 15:12:46OG7setrecipients: + OG7, jnoller, grahamd, ptn, i000
2009-06-10 15:12:46OG7setmessageid: <1244646766.54.0.00453191291083.issue5313@psf.upfronthosting.co.za>
2009-06-10 15:12:45OG7linkissue5313 messages
2009-06-10 15:12:44OG7create