mirror of
https://github.com/python/cpython.git
synced 2025-09-15 13:16:12 +00:00
[3.13] gh-128308: pass **kwargs
to asyncio task_factory (GH-128768) (#130084)
* [3.13] gh-128308: pass `**kwargs` to asyncio task_factory (GH-128768)
(cherry picked from commit 38a9956876
)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
---------
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
parent
9e23e0ad2c
commit
7b0543ebe6
7 changed files with 40 additions and 21 deletions
|
@ -1081,6 +1081,18 @@ class BaseTestTaskGroup:
|
|||
# cancellation happens here and error is more understandable
|
||||
await asyncio.sleep(0)
|
||||
|
||||
async def test_name(self):
|
||||
name = None
|
||||
|
||||
async def asyncfn():
|
||||
nonlocal name
|
||||
name = asyncio.current_task().get_name()
|
||||
|
||||
async with asyncio.TaskGroup() as tg:
|
||||
tg.create_task(asyncfn(), name="example name")
|
||||
|
||||
self.assertEqual(name, "example name")
|
||||
|
||||
|
||||
class TestTaskGroup(BaseTestTaskGroup, unittest.IsolatedAsyncioTestCase):
|
||||
loop_factory = asyncio.EventLoop
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue