Skip to content

Commit b9a7e79

Browse files
miss-islingtongvanrossumAA-Turner
authored
[3.14] gh-128307: Update what's new in 3.13 and 3.14 with create_task changes of asyncio (GH-134304) (#134319)
gh-128307: Update what's new in 3.13 and 3.14 with create_task changes of asyncio (GH-134304) (cherry picked from commit 28625d4) Co-authored-by: Guido van Rossum <[email protected]> Co-authored-by: Adam Turner <[email protected]>
1 parent 2dedf5e commit b9a7e79

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

Doc/whatsnew/3.13.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,22 @@ asyncio
730730
never awaited).
731731
(Contributed by Arthur Tacca and Jason Zhang in :gh:`115957`.)
732732

733+
* The function and methods named ``create_task`` have received a new
734+
``**kwargs`` argument that is passed through to the task constructor.
735+
This change was accidentally added in 3.13.3,
736+
and broke the API contract for custom task factories.
737+
Several third-party task factories implemented workarounds for this.
738+
In 3.13.4 and later releases the old factory contract is honored
739+
once again (until 3.14).
740+
To keep the workarounds working, the extra ``**kwargs`` argument still
741+
allows passing additional keyword arguments to :class:`~asyncio.Task`
742+
and to custom task factories.
743+
744+
This affects the following function and methods:
745+
:meth:`asyncio.create_task`,
746+
:meth:`asyncio.loop.create_task`,
747+
:meth:`asyncio.TaskGroup.create_task`.
748+
(Contributed by Thomas Grainger in :gh:`128307`.)
733749

734750
base64
735751
------

Doc/whatsnew/3.14.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,24 @@ ast
10641064
(Contributed by Semyon Moroz in :gh:`133367`.)
10651065

10661066

1067+
asyncio
1068+
-------
1069+
1070+
* The function and methods named :func:`!create_task` now take an arbitrary
1071+
list of keyword arguments. All keyword arguments are passed to the
1072+
:class:`~asyncio.Task` constructor or the custom task factory.
1073+
(See :meth:`~asyncio.loop.set_task_factory` for details.)
1074+
The ``name`` and ``context`` keyword arguments are no longer special;
1075+
the name should now be set using the ``name`` keyword argument of the factory,
1076+
and ``context`` may be ``None``.
1077+
1078+
This affects the following function and methods:
1079+
:meth:`asyncio.create_task`,
1080+
:meth:`asyncio.loop.create_task`,
1081+
:meth:`asyncio.TaskGroup.create_task`.
1082+
(Contributed by Thomas Grainger in :gh:`128307`.)
1083+
1084+
10671085
bdb
10681086
---
10691087

0 commit comments

Comments
 (0)