]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.11] gh-87474: Fix file descriptor leaks in subprocess.Popen (GH-96351) (#104563)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 17 May 2023 07:48:10 +0000 (00:48 -0700)
committerGitHub <noreply@github.com>
Wed, 17 May 2023 07:48:10 +0000 (00:48 -0700)
commit3ce7d57c8aef98f599bb55d67585a8150ce6d775
tree1188e9e757a14c46ae381a03266c125ef12694ab
parentdece9c06bb0aff150e018ed7975d43e4648bb72e
[3.11] gh-87474: Fix file descriptor leaks in subprocess.Popen (GH-96351) (#104563)

gh-87474: Fix file descriptor leaks in subprocess.Popen (GH-96351)

This fixes several ways file descriptors could be leaked from `subprocess.Popen` constructor during error conditions by opening them later and using a context manager "fds to close" registration scheme to ensure they get closed before returning.

---------

(cherry picked from commit 3a4c44bb1e92802db64deec59cf8a68ad3973219)

Co-authored-by: cptpcrd <31829097+cptpcrd@users.noreply.github.com>
Co-authored-by: Gregory P. Smith [Google] <greg@krypto.org>
Lib/subprocess.py
Misc/NEWS.d/next/Library/2022-08-27-21-41-41.gh-issue-87474.9X-kxt.rst [new file with mode: 0644]