https://github.com/python/cpython/commit/44b655ca0c3e6e4d105555f71018b2d909d9ea8a
commit: 44b655ca0c3e6e4d105555f71018b2d909d9ea8a
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2026-08-04T12:57:13+05:30
summary:

[3.13] gh-145030: Fix asyncio write pipe transport for named FIFOs on Solaris 
(GH-155110) (#155129)

gh-145030: Fix asyncio write pipe transport for named FIFOs on Solaris 
(GH-155110)
(cherry picked from commit 910e584e1733f1cfff17553b340258c31bc74ccd)

Co-authored-by: Jakub KulĂ­k <[email protected]>

files:
M Lib/asyncio/unix_events.py
M Lib/test/test_asyncio/test_events.py
M Misc/NEWS.d/next/Library/2026-07-20-12-40-00.gh-issue-145030.TFJm6k.rst

diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index 2dbb0274ed270c0..62d375f9dcab2e5 100644
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -668,19 +668,19 @@ def __init__(self, loop, pipe, protocol, waiter=None, 
extra=None):
         # On AIX, the reader trick (to be notified when the read end of the
         # socket is closed) only works for sockets. On other platforms it
         # works for pipes and sockets. (Exception: OS X 10.4?  Issue #19294.)
-        # On macOS, the trick misfires for named FIFOs (but not for pipes
-        # created with os.pipe(), which have st_nlink == 0): the write end
-        # polls as readable whenever unread data sits in the FIFO, and no
+        # On macOS and Solaris, the trick misfires for named FIFOs (but not for
+        # pipes created with os.pipe(), which have st_nlink == 0): the write
+        # end polls as readable whenever unread data sits in the FIFO, and no
         # event is delivered when the read end is closed, so it can only
-        # ever report a false disconnection (gh-145030). The same xnu
+        # ever report a false disconnection (gh-145030). The same XNU
         # behaviour applies on iOS/tvOS/watchOS (sys.platform is not
         # "darwin" there).
-        is_named_fifo_on_apple = (
-            sys.platform in {"darwin", "ios", "tvos", "watchos"}
+        is_named_fifo_without_close_event = (
+            sys.platform in {"darwin", "ios", "tvos", "watchos", "sunos5"}
             and is_fifo and pipe_stat.st_nlink > 0)
         if is_socket or (is_fifo
                          and not sys.platform.startswith("aix")
-                         and not is_named_fifo_on_apple):
+                         and not is_named_fifo_without_close_event):
             # only start reading when connection_made() has been called
             self._loop.call_soon(self._loop._add_reader,
                                  self._fileno, self._read_ready)
diff --git a/Lib/test/test_asyncio/test_events.py 
b/Lib/test/test_asyncio/test_events.py
index 35363b0f99dd718..6f8be6dee308080 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -1613,9 +1613,9 @@ def reader(data):
                          "Don't support pipes for Windows")
     @unittest.skipUnless(hasattr(os, 'mkfifo'), 'requires os.mkfifo()')
     def test_write_named_fifo_unread_data(self):
-        # gh-145030: on macOS, the write end of a named FIFO polls as
-        # readable while unread data sits in the FIFO, which made the
-        # transport misinterpret the event as the reader hanging up
+        # gh-145030: on macOS and Solaris, the write end of a named FIFO
+        # polls as readable while unread data sits in the FIFO, which made
+        # the transport misinterpret the event as the reader hanging up
         # and close itself.
         path = os_helper.TESTFN
         os.mkfifo(path)
diff --git 
a/Misc/NEWS.d/next/Library/2026-07-20-12-40-00.gh-issue-145030.TFJm6k.rst 
b/Misc/NEWS.d/next/Library/2026-07-20-12-40-00.gh-issue-145030.TFJm6k.rst
index 2c6b07a4fa8b76f..2f1b717b40ea74a 100644
--- a/Misc/NEWS.d/next/Library/2026-07-20-12-40-00.gh-issue-145030.TFJm6k.rst
+++ b/Misc/NEWS.d/next/Library/2026-07-20-12-40-00.gh-issue-145030.TFJm6k.rst
@@ -1,3 +1,3 @@
-Fix :mod:`asyncio` write pipe transports for named FIFOs on macOS.  Unread
-data sitting in the FIFO made the transport misinterpret a poll event as
-the reader disconnecting, wrongly closing the transport.
+Fix :mod:`asyncio` write pipe transports for named FIFOs on macOS and Solaris.
+Unread data sitting in the FIFO made the transport misinterpret a poll event
+as the reader disconnecting, wrongly closing the transport.

_______________________________________________
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