bpo-42146: Unify cleanup in subprocess_fork_exec()#22970
Merged
gpshead merged 4 commits intopython:masterfrom Nov 1, 2020
Merged
bpo-42146: Unify cleanup in subprocess_fork_exec()#22970gpshead merged 4 commits intopython:masterfrom
gpshead merged 4 commits intopython:masterfrom
Conversation
10b8bc6 to
e41da1d
Compare
Also ignore errors from _enable_gc(): * They are always suppressed by the current code due to a bug. * _enable_gc() is only used if `preexec_fn != None`, which is unsafe. * We don't have a good way to handle errors in case we successfully created a child process.
e41da1d to
89143b4
Compare
Code defensively and also check `pid == -1` when setting the exception as that is the condition we return NULL on to let Python know there was an exception. In theory they are the same. But that depends on `fork()` or `vfork()` behaving as documented and setting errno properly (likely true... but if not we still want an error). This also defends against future bugs if the above code were refactored wrong.
gpshead
approved these changes
Oct 31, 2020
This at least lets the user know that something serious has gone wrong.
gpshead
reviewed
Oct 31, 2020
adorilson
pushed a commit
to adorilson/cpython
that referenced
this pull request
Mar 13, 2021
* bpo-42146: Unify cleanup in subprocess_fork_exec() Also ignore errors from _enable_gc(): * They are always suppressed by the current code due to a bug. * _enable_gc() is only used if `preexec_fn != None`, which is unsafe. * We don't have a good way to handle errors in case we successfully created a child process. Co-authored-by: Gregory P. Smith <greg@krypto.org>
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.


Also ignore errors from _enable_gc():
preexec_fn != None, which is unsafe.created a child process.
https://bugs.python.org/issue42146