]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-87474: Fix file descriptor leaks in subprocess.Popen (#96351)
authorcptpcrd <31829097+cptpcrd@users.noreply.github.com>
Tue, 16 May 2023 20:23:53 +0000 (16:23 -0400)
committerGitHub <noreply@github.com>
Tue, 16 May 2023 20:23:53 +0000 (20:23 +0000)
commit3a4c44bb1e92802db64deec59cf8a68ad3973219
tree471b049b0accb0e66ec2f4a8e6873a3b6f30b9d8
parent20e994c535fea33b827e69323f80fec056a76250
gh-87474: Fix file descriptor leaks in subprocess.Popen (#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.

---------

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]