@@ -361,7 +361,7 @@ Creating Futures and Tasks
361
361
362
362
.. versionadded :: 3.5.2
363
363
364
- .. method :: loop.create_task(coro, *, name=None, context=None, eager_start=None)
364
+ .. method :: loop.create_task(coro, *, name=None, context=None, eager_start=None, **kwargs )
365
365
366
366
Schedule the execution of :ref: `coroutine <coroutine >` *coro *.
367
367
Return a :class: `Task ` object.
@@ -370,6 +370,10 @@ Creating Futures and Tasks
370
370
for interoperability. In this case, the result type is a subclass
371
371
of :class: `Task `.
372
372
373
+ The full function signature is largely the same as that of the
374
+ :class: `Task ` constructor (or factory) - all of the keyword arguments to
375
+ this function are passed through to that interface.
376
+
373
377
If the *name * argument is provided and not ``None ``, it is set as
374
378
the name of the task using :meth: `Task.set_name `.
375
379
@@ -388,8 +392,15 @@ Creating Futures and Tasks
388
392
.. versionchanged :: 3.11
389
393
Added the *context * parameter.
390
394
395
+ .. versionchanged :: 3.13.3
396
+ Added ``kwargs `` which passes on arbitrary extra parameters, including ``name `` and ``context ``.
397
+
398
+ .. versionchanged :: 3.13.4
399
+ Rolled back the change that passes on *name * and *context * (if it is None),
400
+ while still passing on other arbitrary keyword arguments (to avoid breaking backwards compatibility with 3.13.3).
401
+
391
402
.. versionchanged :: 3.14
392
- Added the *eager_start * parameter.
403
+ All * kwargs * are now passed on. The *eager_start * parameter works with eager task factories .
393
404
394
405
.. method :: loop.set_task_factory(factory)
395
406
@@ -402,6 +413,16 @@ Creating Futures and Tasks
402
413
event loop, and *coro * is a coroutine object. The callable
403
414
must pass on all *kwargs *, and return a :class: `asyncio.Task `-compatible object.
404
415
416
+ .. versionchanged :: 3.13.3
417
+ Required that all *kwargs * are passed on to :class: `asyncio.Task `.
418
+
419
+ .. versionchanged :: 3.13.4
420
+ *name * is no longer passed to task factories. *context * is no longer passed
421
+ to task factories if it is ``None ``.
422
+
423
+ .. versionchanged :: 3.14
424
+ *name * and *context * are now unconditionally passed on to task factories again.
425
+
405
426
.. method :: loop.get_task_factory()
406
427
407
428
Return a task factory or ``None `` if the default one is in use.
0 commit comments