gh-109981: Resolve situation on iOS regarding fd_count. (#132823)

Modifies the test helper that counts the list of open file descriptors to use
the optimised ``/dev/fd`` approach on all Apple platforms, not just macOS. This
avoids crashes caused by guarded file descriptors.
This commit is contained in:
John 2025-04-22 22:22:57 -05:00 committed by GitHub
parent b5bf8c80a9
commit 862fd89036
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -657,7 +657,7 @@ def fd_count():
"""
if sys.platform.startswith(('linux', 'android', 'freebsd', 'emscripten')):
fd_path = "/proc/self/fd"
elif sys.platform == "darwin":
elif support.is_apple:
fd_path = "/dev/fd"
else:
fd_path = None

View file

@ -0,0 +1,3 @@
The test helper that counts the list of open file descriptors now uses the
optimised ``/dev/fd`` approach on all Apple platforms, not just macOS.
This avoids crashes caused by guarded file descriptors.