https://github.com/python/cpython/commit/b220c1c0a479fdb362d97735034f7ce2edf1e3db
commit: b220c1c0a479fdb362d97735034f7ce2edf1e3db
branch: 3.13
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: freakboy3742 <russ...@keith-magee.com>
date: 2025-04-23T21:40:25Z
summary:

[3.13] gh-109981: Resolve situation on iOS regarding fd_count. (GH-132823) 
(#132824)

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.
(cherry picked from commit 862fd890361005598a6f4614ea0608c8447831c2)

Co-authored-by: John <johnzhou...@gmail.com>

files:
A Misc/NEWS.d/next/Tests/2025-04-23-02-23-37.gh-issue-109981.IX3k8p.rst
M Lib/test/support/os_helper.py

diff --git a/Lib/test/support/os_helper.py b/Lib/test/support/os_helper.py
index ae016441fdb9a8..26c467a7ad2a85 100644
--- a/Lib/test/support/os_helper.py
+++ b/Lib/test/support/os_helper.py
@@ -630,7 +630,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
diff --git 
a/Misc/NEWS.d/next/Tests/2025-04-23-02-23-37.gh-issue-109981.IX3k8p.rst 
b/Misc/NEWS.d/next/Tests/2025-04-23-02-23-37.gh-issue-109981.IX3k8p.rst
new file mode 100644
index 00000000000000..175615258303bd
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2025-04-23-02-23-37.gh-issue-109981.IX3k8p.rst
@@ -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.

_______________________________________________
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