]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-112182: Replace StopIteration with RuntimeError for future (GH-113220)...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 15 Aug 2024 15:34:53 +0000 (17:34 +0200)
committerGitHub <noreply@github.com>
Thu, 15 Aug 2024 15:34:53 +0000 (15:34 +0000)
commit41090b7ba06f4b68249b825caf4d06560ed16d9c
tree267d5d9e6b0f2cee8e00b8a496ac8208d8a337d6
parent9f153a2acf949cee1d70915d5158e91fda991bcf
[3.12] gh-112182: Replace StopIteration with RuntimeError for future (GH-113220) (GH-123033)

When an `StopIteration` raises into `asyncio.Future`, this will cause
a thread to hang. This commit address this by not raising an exception
and silently transforming the `StopIteration` with a `RuntimeError`,
which the caller can reconstruct from `fut.exception().__cause__`
(cherry picked from commit 4826d52338396758b2d6790a498c2a06eec19a86)

Co-authored-by: Jamie Phan <jamie@ordinarylab.dev>
Lib/asyncio/futures.py
Lib/test/test_asyncio/test_futures.py
Misc/NEWS.d/next/Library/2023-12-17-10-22-55.gh-issue-112182.jLWGlr.rst [new file with mode: 0644]
Modules/_asynciomodule.c