mirror of
https://github.com/python/cpython.git
synced 2025-11-07 17:12:03 +00:00
[3.13] gh-133745: Fix asyncio task factory name/context kwarg breaks (#133948)
In 3.13.3 we accidentally broke the interface for custom task factory. Factory authors added workarounds. This PR (for 3.13.4) unbreaks task factories that haven't made a workaround yet while also supporting those that have. NOTE: The custom task factory API will change to what we accidentally released in 3.13.3. Co-authored-by: Kumar Aditya <kumaraditya@python.org> Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
This commit is contained in:
parent
ebe54d7ab7
commit
fd6a602d04
4 changed files with 32 additions and 18 deletions
|
|
@ -1081,18 +1081,6 @@ async def throw_error():
|
|||
# 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