From c89743d313213e0b226cfbe10cee42bd731d0dd5 Mon Sep 17 00:00:00 2001 From: Krrisha Patel Date: Sun, 12 Jul 2026 14:48:22 -0700 Subject: [PATCH 1/4] Add docstrings for ParkingLot.broken_by and HasFileno.fileno Addresses the remaining unchecked items from #3221: - ParkingLot.broken_by: documents the list of tasks that broke the lot - HasFileno.fileno: documents the protocol method --- src/trio/_core/_parking_lot.py | 1 + src/trio/_subprocess.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/trio/_core/_parking_lot.py b/src/trio/_core/_parking_lot.py index ddf6276117..c44661b5f5 100644 --- a/src/trio/_core/_parking_lot.py +++ b/src/trio/_core/_parking_lot.py @@ -152,6 +152,7 @@ class ParkingLot: # items _parked: OrderedDict[Task, None] = attrs.field(factory=OrderedDict, init=False) broken_by: list[Task] = attrs.field(factory=list, init=False) + """The list of tasks that have broken this lot via :meth:`break_lot`.""" def __len__(self) -> int: """Returns the number of parked tasks.""" diff --git a/src/trio/_subprocess.py b/src/trio/_subprocess.py index d73ba3dc23..33197e9ac8 100644 --- a/src/trio/_subprocess.py +++ b/src/trio/_subprocess.py @@ -98,7 +98,9 @@ def pidfd_open(fd: int, flags: int) -> int: class HasFileno(Protocol): """Represents any file-like object that has a file descriptor.""" - def fileno(self) -> int: ... + def fileno(self) -> int: + """Return the underlying file descriptor as an integer.""" + ... @final From 6673cc4fa631354901fc27b884adc8a4104d602f Mon Sep 17 00:00:00 2001 From: Krrisha Patel Date: Sun, 12 Jul 2026 16:23:09 -0700 Subject: [PATCH 2/4] Add newsfragment for #3221 --- newsfragments/3221.doc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 newsfragments/3221.doc.rst diff --git a/newsfragments/3221.doc.rst b/newsfragments/3221.doc.rst new file mode 100644 index 0000000000..f90aca8094 --- /dev/null +++ b/newsfragments/3221.doc.rst @@ -0,0 +1 @@ +Added docstrings for :attr:`~trio.lowlevel.ParkingLot.broken_by` and :meth:`~trio._subprocess.HasFileno.fileno`. From 7275cd1870ecc42cc5f1713c5c4a9f6a1fdc379f Mon Sep 17 00:00:00 2001 From: Krrisha Patel Date: Sun, 12 Jul 2026 17:25:17 -0700 Subject: [PATCH 3/4] Remove resolved type completeness entries for HasFileno.fileno --- src/trio/_tests/_check_type_completeness.json | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/trio/_tests/_check_type_completeness.json b/src/trio/_tests/_check_type_completeness.json index e5414cfe56..80cdbfcbda 100644 --- a/src/trio/_tests/_check_type_completeness.json +++ b/src/trio/_tests/_check_type_completeness.json @@ -4,8 +4,7 @@ "No docstring found for function \"trio._unix_pipes.FdStream.wait_send_all_might_not_block\"", "No docstring found for function \"trio._unix_pipes.FdStream.receive_some\"", "No docstring found for function \"trio._unix_pipes.FdStream.close\"", - "No docstring found for function \"trio._unix_pipes.FdStream.aclose\"", - "No docstring found for function \"trio._unix_pipes.FdStream.fileno\"" + "No docstring found for function \"trio._unix_pipes.FdStream.aclose\"" ], "Linux": [ "No docstring found for class \"trio._core._io_epoll._EpollStatistics\"", @@ -13,8 +12,7 @@ "No docstring found for function \"trio._unix_pipes.FdStream.wait_send_all_might_not_block\"", "No docstring found for function \"trio._unix_pipes.FdStream.receive_some\"", "No docstring found for function \"trio._unix_pipes.FdStream.close\"", - "No docstring found for function \"trio._unix_pipes.FdStream.aclose\"", - "No docstring found for function \"trio._unix_pipes.FdStream.fileno\"" + "No docstring found for function \"trio._unix_pipes.FdStream.aclose\"" ], "Windows": [], "all": [ @@ -25,7 +23,6 @@ "No docstring found for function \"trio._highlevel_socket.SocketStream.send_eof\"", "No docstring found for function \"trio._highlevel_socket.SocketStream.receive_some\"", "No docstring found for function \"trio._highlevel_socket.SocketStream.aclose\"", - "No docstring found for function \"trio._subprocess.HasFileno.fileno\"", "No docstring found for class \"trio._sync.AsyncContextManagerMixin\"", "No docstring found for function \"trio._sync._HasAcquireRelease.acquire\"", "No docstring found for function \"trio._sync._HasAcquireRelease.release\"", From 5fa7df9b330d8c448b635c67b6508cbf5177376c Mon Sep 17 00:00:00 2001 From: Krrisha Patel Date: Sun, 12 Jul 2026 17:40:22 -0700 Subject: [PATCH 4/4] Keep FdStream.fileno in platform allowlists (only HasFileno.fileno resolved) --- src/trio/_tests/_check_type_completeness.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/trio/_tests/_check_type_completeness.json b/src/trio/_tests/_check_type_completeness.json index 80cdbfcbda..309b4e13f3 100644 --- a/src/trio/_tests/_check_type_completeness.json +++ b/src/trio/_tests/_check_type_completeness.json @@ -4,7 +4,8 @@ "No docstring found for function \"trio._unix_pipes.FdStream.wait_send_all_might_not_block\"", "No docstring found for function \"trio._unix_pipes.FdStream.receive_some\"", "No docstring found for function \"trio._unix_pipes.FdStream.close\"", - "No docstring found for function \"trio._unix_pipes.FdStream.aclose\"" + "No docstring found for function \"trio._unix_pipes.FdStream.aclose\"", + "No docstring found for function \"trio._unix_pipes.FdStream.fileno\"" ], "Linux": [ "No docstring found for class \"trio._core._io_epoll._EpollStatistics\"", @@ -12,7 +13,8 @@ "No docstring found for function \"trio._unix_pipes.FdStream.wait_send_all_might_not_block\"", "No docstring found for function \"trio._unix_pipes.FdStream.receive_some\"", "No docstring found for function \"trio._unix_pipes.FdStream.close\"", - "No docstring found for function \"trio._unix_pipes.FdStream.aclose\"" + "No docstring found for function \"trio._unix_pipes.FdStream.aclose\"", + "No docstring found for function \"trio._unix_pipes.FdStream.fileno\"" ], "Windows": [], "all": [