narrow Subprocess.__init__ Popen except to real Popen failures#3640
Open
HrachShah wants to merge 1 commit into
Open
narrow Subprocess.__init__ Popen except to real Popen failures#3640HrachShah wants to merge 1 commit into
HrachShah wants to merge 1 commit into
Conversation
The bare 'except:' wrapped subprocess.Popen() and a per-init pipe FD cleanup loop. The narrow set covers the actual failures of Popen(): OSError (FileNotFoundError when the executable isn't found, PermissionError when it isn't executable, OSError for other fork/exec failures), ValueError (embedded null byte in executable path), TypeError (unknown kwarg), and subprocess.SubprocessError (parent of all subprocess-raised errors added in Python 3.3; covers the cases where Popen detects an invalid argument combination internally). The bare except was also catching BaseException including KeyboardInterrupt and SystemExit — a Ctrl-C during the Popen call now propagates immediately to the asyncio task that owns the Subprocess instead of being swallowed and re-raised after the FD cleanup loop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
narrow Subprocess.init Popen except to real Popen failures
The bare 'except:' wrapped subprocess.Popen() and a per-init pipe FD
cleanup loop. The narrow set covers the actual failures of Popen():
OSError (FileNotFoundError when the executable isn't found,
PermissionError when it isn't executable, OSError for other fork/exec
failures), ValueError (embedded null byte in executable path),
TypeError (unknown kwarg), and subprocess.SubprocessError (parent of
all subprocess-raised errors added in Python 3.3; covers the cases where
Popen detects an invalid argument combination internally).
The bare except was also catching BaseException including KeyboardInterrupt
and SystemExit — a Ctrl-C during the Popen call now propagates
immediately to the asyncio task that owns the Subprocess instead of
being swallowed and re-raised after the FD cleanup loop.