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 akira
Recipients akira, gregory.p.smith, josh.r, r.david.murray, vstinner
Date 2014-08-28.12:10:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1409227811.99.0.299060727056.issue22274@psf.upfronthosting.co.za>
In-reply-to
Content
Josh, on Windows, if at least one standard stream is replaced; all three
hStdInput, hStdOutput, hStdError handles are provided
(all-or-nothing). On POSIX, standard streams stdin (0), stdout (1),
stderr (2) are always inherited from the parent. Each stream can be
manipulated independently. c2pwrite=-1 is different from providing
c2pwrite=1 (STDOUT_FILENO) explicitly e.g., set_inheritable() call is
made after the fork() in the latter case.

My patch leads to dup2(fileno(stdout), STDERR_FILENO) when stdout is
None and stderr=STDOUT on POSIX i.e., it redirects stderr to the
inherited stdout (like 2>&1 in the shell). It has no effect otherwise.

sys.__stdout__ is used so that the call fails sooner without fork() if
fileno(stdout) is not a valid file descriptor when python initializes
(daemon, GUI). __stdout__-based solution doesn't support a case when
fileno(stdout) is changed later in the program e.g., using freopen() on
some systems.
History
Date User Action Args
2014-08-28 12:10:12akirasetrecipients: + akira, gregory.p.smith, vstinner, r.david.murray, josh.r
2014-08-28 12:10:11akirasetmessageid: <1409227811.99.0.299060727056.issue22274@psf.upfronthosting.co.za>
2014-08-28 12:10:11akiralinkissue22274 messages
2014-08-28 12:10:11akiracreate