https://github.com/python/cpython/commit/7c2d9c94983733ec9a784184da43b9498772485d
commit: 7c2d9c94983733ec9a784184da43b9498772485d
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: jaraco <[email protected]>
date: 2025-12-17T08:20:28-05:00
summary:

[3.13] gh-142836: Avoid /proc fd pipes on Solaris (GH-142853) (#142855)

gh-142836: Avoid /proc fd pipes on Solaris (GH-142853)
(cherry picked from commit c35b812e773493f88631cd1e8be65d3a7c3b47ae)

Co-authored-by: Jason R. Coombs <[email protected]>

files:
A Misc/NEWS.d/next/Tests/2025-12-17-02-02-57.gh-issue-142836.mR-fvK.rst
M Lib/test/test_pdb.py

diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index 044f6e22da08a1..295d01184f5908 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -3072,10 +3072,22 @@ def _assert_find_function(self, file_content, 
func_name, expected):
 
     def _fd_dir_for_pipe_targets(self):
         """Return a directory exposing live file descriptors, if any."""
+        return self._proc_fd_dir() or self._dev_fd_dir()
+
+    def _proc_fd_dir(self):
+        """Return /proc-backed fd dir when it can be used for pipes."""
+        # GH-142836: Opening /proc/self/fd entries for pipes raises EACCES on
+        # Solaris, so prefer other mechanisms there.
+        if sys.platform.startswith("sunos"):
+            return None
+
         proc_fd = "/proc/self/fd"
         if os.path.isdir(proc_fd) and os.path.exists(os.path.join(proc_fd, 
'0')):
             return proc_fd
+        return None
 
+    def _dev_fd_dir(self):
+        """Return /dev-backed fd dir when usable."""
         dev_fd = "/dev/fd"
         if os.path.isdir(dev_fd) and os.path.exists(os.path.join(dev_fd, '0')):
             if sys.platform.startswith("freebsd"):
@@ -3085,7 +3097,6 @@ def _fd_dir_for_pipe_targets(self):
                 except FileNotFoundError:
                     return None
             return dev_fd
-
         return None
 
     def test_find_function_empty_file(self):
diff --git 
a/Misc/NEWS.d/next/Tests/2025-12-17-02-02-57.gh-issue-142836.mR-fvK.rst 
b/Misc/NEWS.d/next/Tests/2025-12-17-02-02-57.gh-issue-142836.mR-fvK.rst
new file mode 100644
index 00000000000000..dd84ce9839ffa9
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2025-12-17-02-02-57.gh-issue-142836.mR-fvK.rst
@@ -0,0 +1 @@
+Accommodated Solaris in ``test_pdb.test_script_target_anonymous_pipe``.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to