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 neologix
Recipients gregory.p.smith, neologix, pitrou, sbt, vstinner
Date 2013-08-23.18:48:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAH_1eM0x+uNot8jE6uNU8djX70rs=L0pQX0Q6NWN6cZCcrjagw@mail.gmail.com>
In-reply-to <1377280652.46.0.477643198579.issue18763@psf.upfronthosting.co.za>
Content
> I don't understand why os.dup2() is more reliable than os.pipe() for a unit
> test?

I use dup2() because it allows me to specify a target FD, so the
parent can know precisely which FD was opened by the preexec hook, and
check it's closed in the child process. With pipe(), the FDs returned
are arbitrary, so the parent can't check them explicitly, and has to
check that no FD > 2 is open in the child, which is fragile.

> Is subprocess_close-default-1.diff portable? test_os uses hasattr(os,
> "dup2"). In Modules/posixmodule.c, it looks like the function is always
> defined!?

Maybe it's not available on Windows, but it's definitely available on Unix.
History
Date User Action Args
2013-08-23 18:48:54neologixsetrecipients: + neologix, gregory.p.smith, pitrou, vstinner, sbt
2013-08-23 18:48:54neologixlinkissue18763 messages
2013-08-23 18:48:54neologixcreate