Skip to content

Commit ca5b169

Browse files
committed
Adjusted docs.
1 parent 47a9fea commit ca5b169

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Doc/library/inspect.rst

+11-7
Original file line numberDiff line numberDiff line change
@@ -348,26 +348,30 @@ attributes:
348348

349349
.. function:: iscoroutinefunction(object)
350350

351-
Return ``True`` if the object is a :term:`coroutine function`
352-
(a function defined with an :keyword:`async def` syntax).
351+
Return ``True`` if the object is a :term:`coroutine function` (a function
352+
defined with an :keyword:`async def` syntax), a :func:`functools.partial`
353+
wrapping a :term:`coroutine function``, or an instance of a class defining
354+
an :keyword:`async def` ``__call__``.
353355

354356
.. versionadded:: 3.5
355357

356358
.. versionchanged:: 3.8
357359
Functions wrapped in :func:`functools.partial` now return ``True`` if the
358360
wrapped function is a :term:`coroutine function`.
359361

362+
.. versionchanged:: 3.12
363+
Instances of classes defining an :keyword:`async def` ``__call__`` now
364+
return ``True``.
365+
360366

361367
.. function:: markcoroutinefunction(func)
362368

363369
Decorator to mark a callable as a :term:`coroutine function` if it would not
364370
otherwise be detected by :func:`iscoroutinefunction`.
365371

366-
This may be of use for sync functions that return an awaitable or objects
367-
implementing an :keyword:`async def` ``__call__``.
368-
369-
Prefer :keyword:`async def` functions or calling the function and testing
370-
the return with :func:`isawaitable` where feasible.
372+
This may be of use for sync functions that return a :term:`coroutine`, but
373+
prefer :keyword:`async def` functions, or if necessary calling the function
374+
and testing the return with :func:`iscoroutine` where feasible.
371375

372376
.. versionadded:: 3.12
373377

0 commit comments

Comments
 (0)