mirror of
https://github.com/python/cpython.git
synced 2025-08-27 04:05:34 +00:00
gh-113753: Clear finalized bit when putting PyAsyncGenASend back into free list (#113754)
This commit is contained in:
parent
901a971e16
commit
73ae2023a7
4 changed files with 16 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue