]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.11] gh-109981: Fix support.fd_count() on macOS 14 (GH-112797) (#112825)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 7 Dec 2023 10:28:54 +0000 (11:28 +0100)
committerGitHub <noreply@github.com>
Thu, 7 Dec 2023 10:28:54 +0000 (11:28 +0100)
commit666a484d295fc96cf8efad4a5d83639dc21cd5e0
tree91bbdc597e2d2c8777818bb3efdd2c7e9920cd2d
parent5fa2d240022301614d5b933f69e0d556ca211eb8
[3.11] gh-109981: Fix support.fd_count() on macOS 14 (GH-112797) (#112825)

gh-109981: Fix support.fd_count() on macOS 14 (GH-112797)

Use scanning "/dev/fd/" on macOS in support.fd_count(). That's both more efficient than scanning all possible file descriptors, and avoids crashing the interpreter when there are open "guarded" file descriptors.

"Guarded" file descriptors are a macOS feature where file descriptors used by system libraries are marked and cause hard crashes when used by "user" code.

(cherry picked from commit 953ee622b3901d3467e65e3484dcfa75ba6fcddf)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/test/support/os_helper.py
Misc/NEWS.d/next/macOS/2023-12-06-12-11-13.gh-issue-109981.mOHg10.rst [new file with mode: 0644]