From 4071cd639e83c6fbfb53b8b57a5a14cba496d9cb Mon Sep 17 00:00:00 2001 From: James Hilton-Balfe Date: Sun, 15 Oct 2023 22:33:17 +0100 Subject: [PATCH 1/4] Fix logic order causing nicer error to never be raised --- Lib/asyncio/timeouts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/asyncio/timeouts.py b/Lib/asyncio/timeouts.py index 029c468739bf2d..826201b8b06e34 100644 --- a/Lib/asyncio/timeouts.py +++ b/Lib/asyncio/timeouts.py @@ -84,9 +84,9 @@ def __repr__(self) -> str: async def __aenter__(self) -> "Timeout": self._state = _State.ENTERED self._task = tasks.current_task() - self._cancelling = self._task.cancelling() if self._task is None: raise RuntimeError("Timeout should be used inside a task") + self._cancelling = self._task.cancelling() self.reschedule(self._when) return self From 10317eae370a6727469b5b1d000c78d661a10b3c Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:40:41 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2023-10-19-11-40-38.gh-issue-0.hBPpQr.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2023-10-19-11-40-38.gh-issue-0.hBPpQr.rst diff --git a/Misc/NEWS.d/next/Library/2023-10-19-11-40-38.gh-issue-0.hBPpQr.rst b/Misc/NEWS.d/next/Library/2023-10-19-11-40-38.gh-issue-0.hBPpQr.rst new file mode 100644 index 00000000000000..7f2bde605d8399 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-10-19-11-40-38.gh-issue-0.hBPpQr.rst @@ -0,0 +1 @@ +Fix asyncio.Timeout raising an AttributeError over a RuntimeError due to logic bug. Patch by James Hilton-Balfe From 35453e2a7141bf6df61dc9bfae5d3f0dffd0e74f Mon Sep 17 00:00:00 2001 From: James Hilton-Balfe Date: Thu, 19 Oct 2023 19:12:49 +0100 Subject: [PATCH 3/4] Update and rename 2023-10-19-11-40-38.gh-issue-0.hBPpQr.rst to 2023-10-19-11-40-38.gh-issue-111085.hBPpQr.rst --- .../next/Library/2023-10-19-11-40-38.gh-issue-0.hBPpQr.rst | 1 - .../next/Library/2023-10-19-11-40-38.gh-issue-111085.hBPpQr.rst | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Library/2023-10-19-11-40-38.gh-issue-0.hBPpQr.rst create mode 100644 Misc/NEWS.d/next/Library/2023-10-19-11-40-38.gh-issue-111085.hBPpQr.rst diff --git a/Misc/NEWS.d/next/Library/2023-10-19-11-40-38.gh-issue-0.hBPpQr.rst b/Misc/NEWS.d/next/Library/2023-10-19-11-40-38.gh-issue-0.hBPpQr.rst deleted file mode 100644 index 7f2bde605d8399..00000000000000 --- a/Misc/NEWS.d/next/Library/2023-10-19-11-40-38.gh-issue-0.hBPpQr.rst +++ /dev/null @@ -1 +0,0 @@ -Fix asyncio.Timeout raising an AttributeError over a RuntimeError due to logic bug. Patch by James Hilton-Balfe diff --git a/Misc/NEWS.d/next/Library/2023-10-19-11-40-38.gh-issue-111085.hBPpQr.rst b/Misc/NEWS.d/next/Library/2023-10-19-11-40-38.gh-issue-111085.hBPpQr.rst new file mode 100644 index 00000000000000..ff4229dae8480a --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-10-19-11-40-38.gh-issue-111085.hBPpQr.rst @@ -0,0 +1 @@ +Fix :class:`asyncio.Timeout` raising an :exc:`AttributeError` over a :exc:`RuntimeError` due to logic bug. Patch by James Hilton-Balfe From a2608eb0e36e874ea4bccb7c4c50b3f2acca52de Mon Sep 17 00:00:00 2001 From: James Hilton-Balfe Date: Thu, 19 Oct 2023 19:49:05 +0100 Subject: [PATCH 4/4] Update ACKS --- Misc/ACKS | 1 + 1 file changed, 1 insertion(+) diff --git a/Misc/ACKS b/Misc/ACKS index 94cb1965676f48..3783f511bb7240 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -760,6 +760,7 @@ Aaron Hill Joel Hillacre Richie Hindle Konrad Hinsen +James Hilton-Balfe Richard Hoberecht David Hobley Tim Hochberg