Python 2.0 - win32pipe routines inclusion for Windows

Guido van Rossum guido at python.org
Wed Jul 26 21:47:24 EDT 2000


David Bolen <db3l at fitlinxx.com> writes:
> While munging around in the source it also appears that there seems to
> be a mismatch between the ordering of file handles returned by the
> higher order popen# routines in the internal posixmodule (the
> win32pipe routines) versus the current popen2.py library module.  I
> think I saw a discussion about this in the python-dev archives, but it
> wasn't clear if the two should be consistent at this point in the
> repository.

It was discovered that the win32pipe module returned the file objects
in the order (stdin, stdout, stderr) while popen2 returned them in the
order (stdout, stdin, stderr).  The latter is clearly strange, so we
decided that the new code should return (stdin, stdout, stderr).

Why was there no consistency between the two modules?  win32pipe
apparently didn't look closely at popen2 -- and in a sense that was
lucky, because popen2 had the order reversed.  Originally, the
reversed order made sense, because the first version of popen2 only
returned stdout and stdin -- in that order.  Because the return values
are in the parent, which must *read* from stdout and *write* to stdin,
it appeared made sense to return the files in the order (read,
write).  But when stderr was added, we ended up with the order (read,
write, read) for (stdout, stdin, stderr).  It was too late to fix for
popen2, but it's not too late to fix it at the occasion of introducing
a new API in a different module!

So there. :-)

-- 
--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)



More information about the Python-list mailing list