Staging
v0.5.1
https://github.com/python/cpython
Revision f4d644f36ffb6cb11b34bfcf533c14cfaebf709a authored by Gregory P. Smith on 30 January 2018, 05:27:39 UTC, committed by GitHub on 30 January 2018, 05:27:39 UTC
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.
1 parent 83e64c8
History
Tip revision: f4d644f36ffb6cb11b34bfcf533c14cfaebf709a authored by Gregory P. Smith on 30 January 2018, 05:27:39 UTC
bpo-25942: make subprocess more graceful on ^C (GH-5026)
Tip revision: f4d644f
File Mode Size
_asyncio.vcxproj -rw-r--r-- 3.0 KB
_asyncio.vcxproj.filters -rw-r--r-- 520 bytes
_bz2.vcxproj -rw-r--r-- 3.9 KB
_bz2.vcxproj.filters -rw-r--r-- 1.7 KB
_contextvars.vcxproj -rw-r--r-- 3.0 KB
_contextvars.vcxproj.filters -rw-r--r-- 525 bytes
_ctypes.vcxproj -rw-r--r-- 4.7 KB
_ctypes.vcxproj.filters -rw-r--r-- 2.3 KB
_ctypes_test.vcxproj -rw-r--r-- 3.1 KB
_ctypes_test.vcxproj.filters -rw-r--r-- 718 bytes
_decimal.vcxproj -rw-r--r-- 5.9 KB
_decimal.vcxproj.filters -rw-r--r-- 4.3 KB
_distutils_findvs.vcxproj -rw-r--r-- 3.4 KB
_distutils_findvs.vcxproj.filters -rw-r--r-- 510 bytes
_elementtree.vcxproj -rw-r--r-- 4.4 KB
_elementtree.vcxproj.filters -rw-r--r-- 2.6 KB
_freeze_importlib.vcxproj -rw-r--r-- 5.2 KB
_freeze_importlib.vcxproj.filters -rw-r--r-- 1.1 KB
_hashlib.vcxproj -rw-r--r-- 3.2 KB
_hashlib.vcxproj.filters -rw-r--r-- 436 bytes
_lzma.vcxproj -rw-r--r-- 3.7 KB
_lzma.vcxproj.filters -rw-r--r-- 435 bytes
_msi.vcxproj -rw-r--r-- 3.1 KB
_msi.vcxproj.filters -rw-r--r-- 423 bytes
_multiprocessing.vcxproj -rw-r--r-- 3.3 KB
_multiprocessing.vcxproj.filters -rw-r--r-- 861 bytes
_overlapped.vcxproj -rw-r--r-- 3.1 KB
_overlapped.vcxproj.filters -rw-r--r-- 434 bytes
_queue.vcxproj -rw-r--r-- 3.0 KB
_queue.vcxproj.filters -rw-r--r-- 518 bytes
_socket.vcxproj -rw-r--r-- 3.2 KB
_socket.vcxproj.filters -rw-r--r-- 702 bytes
_sqlite3.vcxproj -rw-r--r-- 4.5 KB
_sqlite3.vcxproj.filters -rw-r--r-- 2.4 KB
_ssl.vcxproj -rw-r--r-- 3.6 KB
_ssl.vcxproj.filters -rw-r--r-- 620 bytes
_testbuffer.vcxproj -rw-r--r-- 3.0 KB
_testbuffer.vcxproj.filters -rw-r--r-- 435 bytes
_testcapi.vcxproj -rw-r--r-- 3.0 KB
_testcapi.vcxproj.filters -rw-r--r-- 439 bytes
_testconsole.vcxproj -rw-r--r-- 3.2 KB
_testconsole.vcxproj.filters -rw-r--r-- 952 bytes
_testembed.vcxproj -rw-r--r-- 3.1 KB
_testembed.vcxproj.filters -rw-r--r-- 948 bytes
_testimportmultiple.vcxproj -rw-r--r-- 3.0 KB
_testimportmultiple.vcxproj.filters -rw-r--r-- 444 bytes
_testmultiphase.vcxproj -rw-r--r-- 3.2 KB
_testmultiphase.vcxproj.filters -rw-r--r-- 952 bytes
_tkinter.vcxproj -rw-r--r-- 4.1 KB
_tkinter.vcxproj.filters -rw-r--r-- 534 bytes
build.bat -rw-r--r-- 5.8 KB
build_env.bat -rw-r--r-- 25 bytes
clean.bat -rw-r--r-- 128 bytes
env.bat -rw-r--r-- 712 bytes
field3.py -rw-r--r-- 974 bytes
find_msbuild.bat -rw-r--r-- 2.4 KB
find_python.bat -rw-r--r-- 3.0 KB
fix_encoding.py -rw-r--r-- 952 bytes
get_external.py -rw-r--r-- 1.8 KB
get_externals.bat -rw-r--r-- 3.9 KB
idle.bat -rw-r--r-- 296 bytes
lib.pyproj -rw-r--r-- 89.5 KB
liblzma.vcxproj -rw-r--r-- 13.1 KB
openssl.props -rw-r--r-- 1.4 KB
openssl.vcxproj -rw-r--r-- 5.6 KB
pcbuild.proj -rw-r--r-- 5.5 KB
pcbuild.sln -rw-r--r-- 53.8 KB
prepare_ssl.bat -rw-r--r-- 2.3 KB
prepare_ssl.py -rw-r--r-- 6.7 KB
prepare_tcltk.bat -rw-r--r-- 1.9 KB
pyexpat.vcxproj -rw-r--r-- 3.6 KB
pyexpat.vcxproj.filters -rw-r--r-- 1.2 KB
pylauncher.vcxproj -rw-r--r-- 3.2 KB
pylauncher.vcxproj.filters -rw-r--r-- 1.2 KB
pyproject.props -rw-r--r-- 10.4 KB
pyshellext.vcxproj -rw-r--r-- 3.4 KB
pyshellext.vcxproj.filters -rw-r--r-- 1.4 KB
python.props -rw-r--r-- 11.9 KB
python.vcxproj -rw-r--r-- 5.0 KB
python.vcxproj.filters -rw-r--r-- 824 bytes
python3dll.vcxproj -rw-r--r-- 5.8 KB
python3dll.vcxproj.filters -rw-r--r-- 1.2 KB
pythoncore.vcxproj -rw-r--r-- 23.1 KB
pythoncore.vcxproj.filters -rw-r--r-- 34.2 KB
pythonw.vcxproj -rw-r--r-- 3.0 KB
pythonw.vcxproj.filters -rw-r--r-- 702 bytes
pywlauncher.vcxproj -rw-r--r-- 3.2 KB
pywlauncher.vcxproj.filters -rw-r--r-- 1.2 KB
readme.txt -rw-r--r-- 10.9 KB
rmpyc.py -rw-r--r-- 409 bytes
rt.bat -rw-r--r-- 1.9 KB
select.vcxproj -rw-r--r-- 3.1 KB
select.vcxproj.filters -rw-r--r-- 436 bytes
sqlite3.vcxproj -rw-r--r-- 4.1 KB
sqlite3.vcxproj.filters -rw-r--r-- 804 bytes
tcl.vcxproj -rw-r--r-- 3.0 KB
tcltk.props -rw-r--r-- 3.2 KB
tix.vcxproj -rw-r--r-- 3.9 KB
tk.vcxproj -rw-r--r-- 3.2 KB
unicodedata.vcxproj -rw-r--r-- 3.1 KB
unicodedata.vcxproj.filters -rw-r--r-- 810 bytes
urlretrieve.py -rw-r--r-- 1.2 KB
winsound.vcxproj -rw-r--r-- 3.1 KB
winsound.vcxproj.filters -rw-r--r-- 500 bytes
xxlimited.vcxproj -rw-r--r-- 3.2 KB
xxlimited.vcxproj.filters -rw-r--r-- 433 bytes

readme.txt

back to top