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 <johnzhou721@gmail.com>
"""
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
--- /dev/null
+The test helper that counts the list of open file descriptors now uses the\r
+optimised ``/dev/fd`` approach on all Apple platforms, not just macOS.\r
+This avoids crashes caused by guarded file descriptors.\r