[Python-Dev] [Python-checkins] cpython: Switch subprocess stdin to a socketpair, attempting to fix issue #19293 (AIX

Victor Stinner victor.stinner at gmail.com
Tue Oct 22 10:54:03 CEST 2013


Hi,

Would it be possible to use os.pipe() on all OSes except AIX?

Pipes and socket pairs may have minor differences, but some
applications may rely on these minor differences. For example, is the
buffer size the same? For example, in test.support, we have two
constants: PIPE_MAX_SIZE (4 MB) and SOCK_MAX_SIZE (16 MB).

Victor

2013/10/22 guido.van.rossum <python-checkins at python.org>:
> http://hg.python.org/cpython/rev/2a0bda8d283d
> changeset:   86557:2a0bda8d283d
> user:        Guido van Rossum <guido at dropbox.com>
> date:        Mon Oct 21 20:37:14 2013 -0700
> summary:
>   Switch subprocess stdin to a socketpair, attempting to fix issue #19293 (AIX hang).
>
> files:
>   Lib/asyncio/unix_events.py                |  29 +++++++++-
>   Lib/test/test_asyncio/test_unix_events.py |   7 ++
>   2 files changed, 32 insertions(+), 4 deletions(-)
>
>
> diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
> --- a/Lib/asyncio/unix_events.py
> +++ b/Lib/asyncio/unix_events.py
>          if stdin == subprocess.PIPE:
>              self._pipes[STDIN] = None
> +            # Use a socket pair for stdin, since not all platforms
> +            # support selecting read events on the write end of a
> +            # socket (which we use in order to detect closing of the
> +            # other end).  Notably this is needed on AIX, and works
> +            # just fine on other platforms.
> +            stdin, stdin_w = self._loop._socketpair()
>          if stdout == subprocess.PIPE:
>              self._pipes[STDOUT] = None
>          if stderr == subprocess.PIPE:


More information about the Python-Dev mailing list