Skip to content

Commit 338916d

Browse files
committed
gh-157786: Document that asyncio does not support generator-based coroutines
1 parent 1d0f1ad commit 338916d

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎Doc/library/asyncio-task.rst‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ other coroutines::
175175
* a *coroutine object*: an object returned by calling a
176176
*coroutine function*.
177177

178+
Generator-based coroutines, created with :func:`types.coroutine`, are
179+
covered by neither term and are not supported by asyncio.
180+
178181

179182
.. rubric:: Tasks
180183

@@ -242,6 +245,8 @@ Creating tasks
242245

243246
Wrap the *coro* :ref:`coroutine <coroutine>` into a :class:`Task`
244247
and schedule its execution. Return the Task object.
248+
:exc:`TypeError` is raised if *coro* is not a coroutine declared with
249+
:keyword:`async def`.
245250

246251
The full function signature is largely the same as that of the
247252
:class:`Task` constructor (or factory) - all of the keyword arguments to
@@ -1220,6 +1225,10 @@ Introspection
12201225

12211226
.. versionadded:: 3.4
12221227

1228+
.. versionchanged:: 3.12
1229+
Generator-based coroutines are no longer supported, and ``False``
1230+
is returned for them.
1231+
12231232
.. _asyncio-task-obj:
12241233

12251234
Task object

0 commit comments

Comments
 (0)