https://github.com/python/cpython/commit/d6f356e1ab5ccdf1faaf6c431a119217d86201d8
commit: d6f356e1ab5ccdf1faaf6c431a119217d86201d8
branch: 3.14
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: gpshead <g...@krypto.org>
date: 2025-05-31T14:55:03Z
summary:

[3.14] gh-134954: Hard-cap max file descriptors in subprocess test fd_status 
(GH-134955) (#134980)

gh-134954: Hard-cap max file descriptors in subprocess test fd_status 
(GH-134955)

* Hard-cap max file descriptors in subprocess test fd_status

On some systems, `SC_OPEN_MAX` may return a very large value (i.e. 10**30), 
leading to the subprocess test timing out (or run forever).
Prevent this situation by applying a hard cap on how many file descriptors are 
checked.

* Fix typo in usage docstring

s/fd_stats/fd_status/
(cherry picked from commit f58873e4b2b7aad8e3a08a6188c6eb08d0a3001b)

Co-authored-by: Itamar Oren <itamar...@gmail.com>

files:
M Lib/test/subprocessdata/fd_status.py

diff --git a/Lib/test/subprocessdata/fd_status.py 
b/Lib/test/subprocessdata/fd_status.py
index d12bd95abee61c..90e785981aeab0 100644
--- a/Lib/test/subprocessdata/fd_status.py
+++ b/Lib/test/subprocessdata/fd_status.py
@@ -2,7 +2,7 @@
 file descriptors on stdout.
 
 Usage:
-fd_stats.py: check all file descriptors
+fd_status.py: check all file descriptors (up to 255)
 fd_status.py fd1 fd2 ...: check only specified file descriptors
 """
 
@@ -18,7 +18,7 @@
             _MAXFD = os.sysconf("SC_OPEN_MAX")
         except:
             _MAXFD = 256
-        test_fds = range(0, _MAXFD)
+        test_fds = range(0, min(_MAXFD, 256))
     else:
         test_fds = map(int, sys.argv[1:])
     for fd in test_fds:

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: arch...@mail-archive.com

Reply via email to