@@ -843,17 +843,16 @@ Timeouts
843843 Wait for the *fut * :ref: `awaitable <asyncio-awaitables >`
844844 to complete with a timeout.
845845
846- If *fut * is a coroutine it is automatically scheduled as a Task.
846+ If *fut * is a coroutine, it is awaited directly rather than being wrapped
847+ in a :class: `Task `, unless *timeout * is zero or negative.
847848
848849 *timeout * can either be ``None `` or a float or int number of seconds
849850 to wait for. If *timeout * is ``None ``, block until the future
850851 completes.
851852
852- If a timeout occurs, it cancels the task and raises
853- :exc: `TimeoutError `.
853+ If a timeout occurs, it cancels *fut * and raises :exc: `TimeoutError `.
854854
855- To avoid the task :meth: `cancellation <Task.cancel> `,
856- wrap it in :func: `shield `.
855+ To prevent *fut * from being cancelled, wrap it in :func: `shield `.
857856
858857 The function will wait until the future is actually cancelled,
859858 so the total wait time may exceed the *timeout *. If an exception
@@ -894,6 +893,10 @@ Timeouts
894893 .. versionchanged :: 3.11
895894 Raises :exc: `TimeoutError ` instead of :exc: `asyncio.TimeoutError `.
896895
896+ .. versionchanged :: 3.12
897+ Implemented using :func: `asyncio.timeout `, a coroutine passed as *fut *
898+ is no longer wrapped in a :class: `Task ` when *timeout * is positive.
899+
897900
898901Waiting primitives
899902==================
0 commit comments