Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adjust iscoroutinefunction() to look for async __call__.
  • Loading branch information
carltongibson committed Nov 17, 2022
commit fa22a1631ebaf49f54d45eb36057ac3a49ca26f6
4 changes: 3 additions & 1 deletion Lib/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,9 @@ def iscoroutinefunction(obj):

Coroutine functions are defined with "async def" syntax.
"""
return _has_code_flag(obj, CO_COROUTINE)
return _has_code_flag(obj, CO_COROUTINE) or (
Comment thread
gvanrossum marked this conversation as resolved.
Outdated
callable(obj) and _has_code_flag(obj.__call__, CO_COROUTINE)
)

def isasyncgenfunction(obj):
"""Return true if the object is an asynchronous generator function.
Expand Down