Author OG7
Recipients OG7, grahamd, i000, jnoller, ptn
Date 2009-06-19.15:55:23
SpamBayes Score 2.25327e-07
Marked as misclassified No
Message-id <1245426926.05.0.964162416741.issue5313@psf.upfronthosting.co.za>
In-reply-to
Content
Please do this:

--- a/multiprocessing/process.py
+++ b/multiprocessing/process.py
@@ -225,7 +225,8 @@ class Process(object):
             self._children = set()
             self._counter = itertools.count(1)
             try:
-                os.close(sys.stdin.fileno())
+                sys.stdin.close()
+                sys.stdin = open(os.devnull)
             except (OSError, ValueError):
                 pass
             _current_process = self

One shouldn't close the fileno after the file has been closed. The
stdlib raises an error, and the open(os.devnull) won't be reached. If no
error was thrown, it would be worse. This would be closing a fileno that
doesn't belong to sys.stdin anymore and may be used somewhere else.

The open(os.devnull) bit is both so that no one tries to do anything
with the old stdin anymore, and to let applications attempt to read from
stdin without an IOError.
History
Date User Action Args
2009-06-19 15:55:26OG7setrecipients: + OG7, jnoller, grahamd, ptn, i000
2009-06-19 15:55:26OG7setmessageid: <1245426926.05.0.964162416741.issue5313@psf.upfronthosting.co.za>
2009-06-19 15:55:24OG7linkissue5313 messages
2009-06-19 15:55:23OG7create