<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/cpython-git.git/Lib/subprocess.py, branch fix-misc-acks</title>
<subtitle>github.com: python/cpython.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/'/>
<entry>
<title>bpo-37424: Avoid a hang in subprocess.run timeout output capture (GH-14490)</title>
<updated>2019-09-11T10:05:58+00:00</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2019-09-11T10:05:58+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=5fe153c21de020f37712910b0dcce93341bba272'/>
<id>5fe153c21de020f37712910b0dcce93341bba272</id>
<content type='text'>
Fixes a possible hang when using a timeout on subprocess.run() while
capturing output. If the child process spawned its own children or otherwise
connected its stdout or stderr handles with another process, we could hang
after the timeout was reached and our child was killed when attempting to read
final output from the pipes.
(cherry picked from commit 580d2782f70f8e0bed7ec20abb03d740cb83b5da)

Co-authored-by: Gregory P. Smith &lt;greg@krypto.org&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes a possible hang when using a timeout on subprocess.run() while
capturing output. If the child process spawned its own children or otherwise
connected its stdout or stderr handles with another process, we could hang
after the timeout was reached and our child was killed when attempting to read
final output from the pipes.
(cherry picked from commit 580d2782f70f8e0bed7ec20abb03d740cb83b5da)

Co-authored-by: Gregory P. Smith &lt;greg@krypto.org&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Fix subprocess docstring typo (GH-15812)</title>
<updated>2019-09-10T14:48:22+00:00</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2019-09-10T14:48:22+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=9f54feabee26133ac64c6d0e58969005b30614d3'/>
<id>9f54feabee26133ac64c6d0e58969005b30614d3</id>
<content type='text'>
(cherry picked from commit 182e1d1f849757439f2031504f142fa4e1251611)

Co-authored-by: Matthias &lt;xmatthias@outlook.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(cherry picked from commit 182e1d1f849757439f2031504f142fa4e1251611)

Co-authored-by: Matthias &lt;xmatthias@outlook.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-37380: subprocess: don't use _active on win (GH-14360) (GH-15706)</title>
<updated>2019-09-06T09:14:24+00:00</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2019-09-06T09:14:24+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=1e2707d7e82aedf73c59772bc7aa228286323c3c'/>
<id>1e2707d7e82aedf73c59772bc7aa228286323c3c</id>
<content type='text'>
As noted by @eryksun in [1] and [2], using _cleanup and _active(in
__del__) is not necessary on Windows, since:

&gt; Unlike Unix, a process in Windows doesn't have to be waited on by
&gt; its parent to avoid a zombie. Keeping the handle open will actually
&gt; create a zombie until the next _cleanup() call, which may be never
&gt; if Popen() isn't called again.

This patch simply defines `subprocess._active` as `None`, for which we already
have the proper logic in place in `subprocess.Popen.__del__`, that prevents it
from trying to append the process to the `_active`. This patch also defines
`subprocess._cleanup` as a noop for Windows.

[1] https://bugs.python.org/issue37380GH-msg346333
[2] https://bugs.python.org/issue36067GH-msg336262

Signed-off-by: Ruslan Kuprieiev &lt;ruslan@iterative.ai&gt;
(cherry picked from commit 042821ae3cf537e01963c9ec85d1a454d921e826)

Co-authored-by: Ruslan Kuprieiev &lt;kupruser@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As noted by @eryksun in [1] and [2], using _cleanup and _active(in
__del__) is not necessary on Windows, since:

&gt; Unlike Unix, a process in Windows doesn't have to be waited on by
&gt; its parent to avoid a zombie. Keeping the handle open will actually
&gt; create a zombie until the next _cleanup() call, which may be never
&gt; if Popen() isn't called again.

This patch simply defines `subprocess._active` as `None`, for which we already
have the proper logic in place in `subprocess.Popen.__del__`, that prevents it
from trying to append the process to the `_active`. This patch also defines
`subprocess._cleanup` as a noop for Windows.

[1] https://bugs.python.org/issue37380GH-msg346333
[2] https://bugs.python.org/issue36067GH-msg336262

Signed-off-by: Ruslan Kuprieiev &lt;ruslan@iterative.ai&gt;
(cherry picked from commit 042821ae3cf537e01963c9ec85d1a454d921e826)

Co-authored-by: Ruslan Kuprieiev &lt;kupruser@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-34886: Fix subprocess.run handling of exclusive arguments (GH-11727)</title>
<updated>2019-06-08T15:24:10+00:00</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2019-06-08T15:24:10+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=10b4fd98142edef6ab7b034e10ae5c9551043999'/>
<id>10b4fd98142edef6ab7b034e10ae5c9551043999</id>
<content type='text'>
Fix an unintended ValueError from :func:`subprocess.run` when checking for
conflicting `input` and `stdin` or `capture_output` and `stdout` or `stderr` args
when they were explicitly provided but with `None` values within a passed in
`**kwargs` dict rather than as passed directly by name.
(cherry picked from commit 8cc605acdda5aff250ab4c9b524a7560f90ca9f3)

Co-authored-by: Rémi Lapeyre &lt;remi.lapeyre@henki.fr&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix an unintended ValueError from :func:`subprocess.run` when checking for
conflicting `input` and `stdin` or `capture_output` and `stdout` or `stderr` args
when they were explicitly provided but with `None` values within a passed in
`**kwargs` dict rather than as passed directly by name.
(cherry picked from commit 8cc605acdda5aff250ab4c9b524a7560f90ca9f3)

Co-authored-by: Rémi Lapeyre &lt;remi.lapeyre@henki.fr&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-34812: subprocess._args_from_interpreter_flags(): add isolated (GH-10675)</title>
<updated>2018-11-23T17:13:32+00:00</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2018-11-23T17:13:32+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=01e579949ab546cd4cdd0d6d18e3ef41ce94f46e'/>
<id>01e579949ab546cd4cdd0d6d18e3ef41ce94f46e</id>
<content type='text'>
The "-I" command line option (run Python in isolated mode) is now
also copied by the multiprocessing and distutils modules when
spawning child processes. Previously, only -E and -s options (enabled
by -I) were copied.

subprocess._args_from_interpreter_flags() now copies the -I flag.
(cherry picked from commit 9de363271519e0616f4a7b59427057c4810d3acc)

Co-authored-by: Victor Stinner &lt;vstinner@redhat.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The "-I" command line option (run Python in isolated mode) is now
also copied by the multiprocessing and distutils modules when
spawning child processes. Previously, only -E and -s options (enabled
by -I) were copied.

subprocess._args_from_interpreter_flags() now copies the -I flag.
(cherry picked from commit 9de363271519e0616f4a7b59427057c4810d3acc)

Co-authored-by: Victor Stinner &lt;vstinner@redhat.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-34044: subprocess.Popen copies startupinfo (GH-8090) (GH-8121)</title>
<updated>2018-07-05T21:15:28+00:00</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@redhat.com</email>
</author>
<published>2018-07-05T21:15:28+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=29be3bd3c9aed0190e60096a603120cacda82375'/>
<id>29be3bd3c9aed0190e60096a603120cacda82375</id>
<content type='text'>
subprocess.Popen now copies the startupinfo argument to leave it
unchanged: it will modify the copy, so that the same STARTUPINFO
object can be used multiple times.

Add subprocess.STARTUPINFO._copy() private method.

Python 3.7 backport from master makes the copy() private: renamed to
_copy().

(cherry picked from commit 483422f57e5d8c8bf8820fec29fc9b96bb15d4ef)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
subprocess.Popen now copies the startupinfo argument to leave it
unchanged: it will modify the copy, so that the same STARTUPINFO
object can be used multiple times.

Add subprocess.STARTUPINFO._copy() private method.

Python 3.7 backport from master makes the copy() private: renamed to
_copy().

(cherry picked from commit 483422f57e5d8c8bf8820fec29fc9b96bb15d4ef)</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "bpo-31961: subprocess now accepts path-like args (GH-4329)" (GH-5912) (GH-5931)</title>
<updated>2018-02-27T23:30:30+00:00</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2018-02-27T23:30:30+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=b7dcae358e9d5a3ac9dafec9f6b64e9a66843ad8'/>
<id>b7dcae358e9d5a3ac9dafec9f6b64e9a66843ad8</id>
<content type='text'>
* Revert "bpo-31961: subprocess now accepts path-like args (GH-4329)"

This reverts commit dd42cb71f2cb02f3a32f016137b12a146bc0d0e2.
(cherry picked from commit be50a7b627d0aa37e08fa8e2d5568891f19903ce)

Co-authored-by: Serhiy Storchaka &lt;storchaka@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Revert "bpo-31961: subprocess now accepts path-like args (GH-4329)"

This reverts commit dd42cb71f2cb02f3a32f016137b12a146bc0d0e2.
(cherry picked from commit be50a7b627d0aa37e08fa8e2d5568891f19903ce)

Co-authored-by: Serhiy Storchaka &lt;storchaka@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-31961: subprocess now accepts path-like args (GH-4329)</title>
<updated>2018-01-30T07:27:28+00:00</updated>
<author>
<name>Anders Lorentsen</name>
<email>Phaqui@gmail.com</email>
</author>
<published>2018-01-30T07:27:28+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=dd42cb71f2cb02f3a32f016137b12a146bc0d0e2'/>
<id>dd42cb71f2cb02f3a32f016137b12a146bc0d0e2</id>
<content type='text'>
Allow os.PathLike args in subprocess APIs.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Allow os.PathLike args in subprocess APIs.</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-32102 Add "capture_output=True" to subprocess.run (GH-5149)</title>
<updated>2018-01-30T06:40:39+00:00</updated>
<author>
<name>Bo Bayles</name>
<email>bbayles@gmail.com</email>
</author>
<published>2018-01-30T06:40:39+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=ce0f33d04528fcafc673a8707871f8430d8f7ce8'/>
<id>ce0f33d04528fcafc673a8707871f8430d8f7ce8</id>
<content type='text'>
Add "capture_output=True" option to subprocess.run, this is equivalent to
setting stdout=PIPE, stderr=PIPE but is much more readable.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add "capture_output=True" option to subprocess.run, this is equivalent to
setting stdout=PIPE, stderr=PIPE but is much more readable.</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-25942: make subprocess more graceful on ^C (GH-5026)</title>
<updated>2018-01-30T05:27:39+00:00</updated>
<author>
<name>Gregory P. Smith</name>
<email>greg@krypto.org</email>
</author>
<published>2018-01-30T05:27:39+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=f4d644f36ffb6cb11b34bfcf533c14cfaebf709a'/>
<id>f4d644f36ffb6cb11b34bfcf533c14cfaebf709a</id>
<content type='text'>
Do not allow receiving a SIGINT to cause the subprocess module to trigger an
immediate SIGKILL of the child process.  SIGINT is normally sent to all child
processes by the OS at the same time already as was the established normal
behavior in 2.7 and 3.2.  This behavior change was introduced during the fix to https://bugs.python.org/issue12494 and is generally surprising to command line
tool users who expect other tools launched in child processes to get their own
SIGINT and do their own cleanup.

In Python 3.3-3.6 subprocess.call and subprocess.run would immediately
SIGKILL the child process upon receiving a SIGINT (which raises a
KeyboardInterrupt).  We now give the child a small amount of time to
exit gracefully before resorting to a SIGKILL.

This is also the case for subprocess.Popen.__exit__ which would
previously block indefinitely waiting for the child to die.  This was
hidden from many users by virtue of subprocess.call and subprocess.run
sending the signal immediately.

Behavior change: subprocess.Popen.__exit__ will not block indefinitely
when the exiting exception is a KeyboardInterrupt.  This is done for
user friendliness as people expect their ^C to actually happen.  This
could cause occasional orphaned Popen objects when not using `call` or
`run` with a child process that hasn't exited.

Refactoring involved: The Popen.wait method deals with the
KeyboardInterrupt second chance, existing platform specific internals
have been renamed to _wait().
Also fixes comment typos.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Do not allow receiving a SIGINT to cause the subprocess module to trigger an
immediate SIGKILL of the child process.  SIGINT is normally sent to all child
processes by the OS at the same time already as was the established normal
behavior in 2.7 and 3.2.  This behavior change was introduced during the fix to https://bugs.python.org/issue12494 and is generally surprising to command line
tool users who expect other tools launched in child processes to get their own
SIGINT and do their own cleanup.

In Python 3.3-3.6 subprocess.call and subprocess.run would immediately
SIGKILL the child process upon receiving a SIGINT (which raises a
KeyboardInterrupt).  We now give the child a small amount of time to
exit gracefully before resorting to a SIGKILL.

This is also the case for subprocess.Popen.__exit__ which would
previously block indefinitely waiting for the child to die.  This was
hidden from many users by virtue of subprocess.call and subprocess.run
sending the signal immediately.

Behavior change: subprocess.Popen.__exit__ will not block indefinitely
when the exiting exception is a KeyboardInterrupt.  This is done for
user friendliness as people expect their ^C to actually happen.  This
could cause occasional orphaned Popen objects when not using `call` or
`run` with a child process that hasn't exited.

Refactoring involved: The Popen.wait method deals with the
KeyboardInterrupt second chance, existing platform specific internals
have been renamed to _wait().
Also fixes comment typos.</pre>
</div>
</content>
</entry>
</feed>
