aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_asyncgen.py
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2024-01-10 13:18:38 -0500
committerGitHub <noreply@github.com>2024-01-10 10:18:38 -0800
commit73ae2023a76f199ff854f8da14bd9ff8e93ee7fd (patch)
tree15945814e01279d22bcff6c49b149a4fb7872c3f /Lib/test/test_asyncgen.py
parent901a971e161e060bd95f3cf3aeebe8b48d6e6dac (diff)
downloadcpython-73ae2023a76f199ff854f8da14bd9ff8e93ee7fd.tar.gz
cpython-73ae2023a76f199ff854f8da14bd9ff8e93ee7fd.zip
gh-113753: Clear finalized bit when putting PyAsyncGenASend back into free list (#113754)
Diffstat (limited to 'Lib/test/test_asyncgen.py')
-rw-r--r--Lib/test/test_asyncgen.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_asyncgen.py b/Lib/test/test_asyncgen.py
index a49630112af..7fa0a85100a 100644
--- a/Lib/test/test_asyncgen.py
+++ b/Lib/test/test_asyncgen.py
@@ -1701,6 +1701,14 @@ class TestUnawaitedWarnings(unittest.TestCase):
async def gen():
yield 1
+ # gh-113753: asend objects allocated from a free-list should warn.
+ # Ensure there is a finalized 'asend' object ready to be reused.
+ try:
+ g = gen()
+ g.asend(None).send(None)
+ except StopIteration:
+ pass
+
msg = f"coroutine method 'asend' of '{gen.__qualname__}' was never awaited"
with self.assertWarnsRegex(RuntimeWarning, msg):
g = gen()