summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorPeter Bierma <zintensitydev@gmail.com>2024-07-27 06:27:48 (GMT)
committerGitHub <noreply@github.com>2024-07-27 06:27:48 (GMT)
commitc08696286f52d286674f264eecf7b33a335a890b (patch)
treebf6f7f29e48e693ad854f5e83e8fc8b262d1161a /Lib/test/test_asyncio
parent863a92f2bc708b9e3dfa9828bb8155b8d371e09c (diff)
downloadcpython-c08696286f52d286674f264eecf7b33a335a890b.zip
cpython-c08696286f52d286674f264eecf7b33a335a890b.tar.gz
cpython-c08696286f52d286674f264eecf7b33a335a890b.tar.bz2
gh-122332: Fix missing `NULL` check in `asyncio.Task.get_coro` (#122338)
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_eager_task_factory.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_eager_task_factory.py b/Lib/test/test_asyncio/test_eager_task_factory.py
index 0f8212d..0777f39 100644
--- a/Lib/test/test_asyncio/test_eager_task_factory.py
+++ b/Lib/test/test_asyncio/test_eager_task_factory.py
@@ -241,6 +241,18 @@ class CEagerTaskFactoryLoopTests(EagerTaskFactoryLoopTests, test_utils.TestCase)
_, out, err = assert_python_ok("-c", code)
self.assertFalse(err)
+ def test_issue122332(self):
+ async def coro():
+ pass
+
+ async def run():
+ task = self.loop.create_task(coro())
+ await task
+ self.assertIsNone(task.get_coro())
+
+ self.run_coro(run())
+
+
class AsyncTaskCounter:
def __init__(self, loop, *, task_class, eager):
self.suspense_count = 0