Message 151508 - Python tracker

Message151508

Author brandjon
Recipients brandjon
Date 2012-01-18.01:15:42
SpamBayes Score 9.749623e-09
Marked as misclassified No
Message-id <1326849345.92.0.83488691035.issue13812@psf.upfronthosting.co.za>
In-reply-to
Content
When a child process exits due to an exception, a traceback is written, but stderr is not flushed. Thus I see a header like "Process 1:\n", but no traceback.

I don't have a development environment or any experience with Mecurial, so I'm afraid there's no patch, but it's a one-liner.

In   /Lib/multiprocess/process.py :: Process._bootstrap

    except:
        exitcode = 1
        import traceback
        sys.stderr.write('Process %s:\n' % self.name)
        sys.stderr.flush()
        traceback.print_exc()

Append a "sys.stderr.flush()" to the suite.

It surprised me that flushing was even necessary. I would've thought that the standard streams would all be closed just before the process terminated, regardless of exit status. But I observe that unless I explicitly flush stdout and stderr before terminating, the output is lost entirely, even if the exit is not abnormal. This isn't the desired behavior, is it?
History
Date User Action Args
2012-01-18 01:15:46brandjonsetrecipients: + brandjon
2012-01-18 01:15:45brandjonsetmessageid: <1326849345.92.0.83488691035.issue13812@psf.upfronthosting.co.za>
2012-01-18 01:15:45brandjonlinkissue13812 messages
2012-01-18 01:15:42brandjoncreate