From e0e3989681c4f2e555691cc8aad679c64df7d61a Mon Sep 17 00:00:00 2001 From: Aslan Osmanov Date: Thu, 22 Oct 2026 14:05:06 +0000 Subject: [PATCH] gh-160239: Remove dead _repr_info() methods from asyncio.windows_events Future.__repr__() now uses base_futures._future_repr() instead of _repr_info(), so these overrides are dead and their super()._repr_info() call would raise AttributeError. --- Lib/asyncio/windows_events.py | 17 ----------------- ...26-10-22-14-04-17.gh-issue-160239.A1b2C3.rst | 1 + 2 files changed, 1 insertion(+), 17 deletions(-) create mode 100644 Misc/NEWS.d/next/Windows/2026-10-22-14-04-17.gh-issue-160239.A1b2C3.rst diff --git a/Lib/asyncio/windows_events.py b/Lib/asyncio/windows_events.py index cb00670c006c870..a67c21b3f46c4cb 100644 --- a/Lib/asyncio/windows_events.py +++ b/Lib/asyncio/windows_events.py @@ -55,13 +55,6 @@ def __init__(self, ov, *, loop=None): del self._source_traceback[-1] self._ov = ov - def _repr_info(self): - info = super()._repr_info() - if self._ov is not None: - state = 'pending' if self._ov.pending else 'completed' - info.insert(1, f'overlapped=<{state}, {self._ov.address:#x}>') - return info - def _cancel_overlapped(self): if self._ov is None: return @@ -113,16 +106,6 @@ def _poll(self): return (_winapi.WaitForSingleObject(self._handle, 0) == _winapi.WAIT_OBJECT_0) - def _repr_info(self): - info = super()._repr_info() - info.append(f'handle={self._handle:#x}') - if self._handle is not None: - state = 'signaled' if self._poll() else 'waiting' - info.append(state) - if self._wait_handle is not None: - info.append(f'wait_handle={self._wait_handle:#x}') - return info - def _unregister_wait_cb(self, fut): # The wait was unregistered: it's not safe to destroy the Overlapped # object diff --git a/Misc/NEWS.d/next/Windows/2026-10-22-14-04-17.gh-issue-160239.A1b2C3.rst b/Misc/NEWS.d/next/Windows/2026-10-22-14-04-17.gh-issue-160239.A1b2C3.rst new file mode 100644 index 000000000000000..6ca8aace90e676e --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2026-10-22-14-04-17.gh-issue-160239.A1b2C3.rst @@ -0,0 +1 @@ +Remove dead and broken ``_repr_info()`` methods from ``asyncio.windows_events``; they called ``Future._repr_info()``, which no longer exists.