Skip to content
Closed
Prev Previous commit
only warn when 'asyncio.coroutines._is_coroutine' flag is used
  • Loading branch information
graingert committed Jul 19, 2022
commit e9d2eb3aa92f15fe7ad603acdcb0d40e33790f02
11 changes: 8 additions & 3 deletions Lib/asyncio/coroutines.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ def _is_debug_mode():

def iscoroutinefunction(func):
"""Return True if func is a decorated coroutine function."""
warnings._deprecated("asyncio.iscoroutinefunction", remove=(3, 14))
return (inspect.iscoroutinefunction(func) or
getattr(func, '_is_coroutine', None) is _is_coroutine)
if inspect.iscoroutinefunction(func):
return True

if getattr(func, '_is_coroutine', None) is _is_coroutine:
warnings._deprecated("asyncio.coroutines._is_coroutine", remove=(3, 14))
return True

return False


# Prioritize native coroutine check to speed-up
Expand Down