From: Antoine Pitrou Date: Fri, 27 Jan 2012 09:53:35 +0000 (+0100) Subject: Issue #13812: When a multiprocessing Process child raises an exception, flush stderr... X-Git-Tag: v3.3.0a1~294 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2d843d25204af3a791f31b1b941675da49be82ed;p=thirdparty%2FPython%2Fcpython.git Issue #13812: When a multiprocessing Process child raises an exception, flush stderr after printing the exception traceback. --- 2d843d25204af3a791f31b1b941675da49be82ed diff --cc Lib/multiprocessing/forking.py index 47746cb179d1,4e24d6a10fa2..b7de5679b1b2 --- a/Lib/multiprocessing/forking.py +++ b/Lib/multiprocessing/forking.py @@@ -129,15 -124,8 +129,13 @@@ if sys.platform != 'win32' import random random.seed() code = process_obj._bootstrap() - sys.stdout.flush() - sys.stderr.flush() os._exit(code) + # `w` will be closed when the child exits, at which point `r` + # will become ready for reading (using e.g. select()). + os.close(w) + util.Finalize(self, os.close, (r,)) + def poll(self, flag=os.WNOHANG): if self.returncode is None: try: