]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-128307: Update what's new in 3.13 and 3.14 with create_task changes of asyncio...
authorGuido van Rossum <guido@python.org>
Tue, 20 May 2025 08:41:22 +0000 (04:41 -0400)
committerGitHub <noreply@github.com>
Tue, 20 May 2025 08:41:22 +0000 (14:11 +0530)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Doc/whatsnew/3.13.rst
Doc/whatsnew/3.14.rst

index 023c279979d842c7812ef6629c52772eef8e8c21..580a3d8154dee13e202571378d8f4a5e5cde8b5f 100644 (file)
@@ -730,6 +730,22 @@ asyncio
   never awaited).
   (Contributed by Arthur Tacca and Jason Zhang in :gh:`115957`.)
 
+* The function and methods named ``create_task`` have received a new
+  ``**kwargs`` argument that is passed through to the task constructor.
+  This change was accidentally added in 3.13.3,
+  and broke the API contract for custom task factories.
+  Several third-party task factories implemented workarounds for this.
+  In 3.13.4 and later releases the old factory contract is honored
+  once again (until 3.14).
+  To keep the workarounds working, the extra ``**kwargs`` argument still
+  allows passing additional keyword arguments to :class:`~asyncio.Task`
+  and to custom task factories.
+
+  This affects the following function and methods:
+  :meth:`asyncio.create_task`,
+  :meth:`asyncio.loop.create_task`,
+  :meth:`asyncio.TaskGroup.create_task`.
+  (Contributed by Thomas Grainger in :gh:`128307`.)
 
 base64
 ------
index 8f39b99e38e3a5d4d94f0be6595702959c30fd69..b192615e173f1182522bc025ecb714b7e6b2984f 100644 (file)
@@ -1064,6 +1064,24 @@ ast
   (Contributed by Semyon Moroz in :gh:`133367`.)
 
 
+asyncio
+-------
+
+* The function and methods named :func:`!create_task` now take an arbitrary
+  list of keyword arguments. All keyword arguments are passed to the
+  :class:`~asyncio.Task` constructor or the custom task factory.
+  (See :meth:`~asyncio.loop.set_task_factory` for details.)
+  The ``name`` and ``context`` keyword arguments are no longer special;
+  the name should now be set using the ``name`` keyword argument of the factory,
+  and ``context`` may be ``None``.
+
+  This affects the following function and methods:
+  :meth:`asyncio.create_task`,
+  :meth:`asyncio.loop.create_task`,
+  :meth:`asyncio.TaskGroup.create_task`.
+  (Contributed by Thomas Grainger in :gh:`128307`.)
+
+
 bdb
 ---