summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/coroutines.py
diff options
context:
space:
mode:
authorWulian <1055917385@qq.com>2024-08-11 16:35:51 (GMT)
committerGitHub <noreply@github.com>2024-08-11 16:35:51 (GMT)
commitbc9d92c67933917b474e61905451c6408c68e71d (patch)
tree3cbe6bee6f8d7029f26b7bdfdb5c57873088e073 /Lib/asyncio/coroutines.py
parent3aaed083a3f5eb7e490495c460b3dc1ce7451ce8 (diff)
downloadcpython-bc9d92c67933917b474e61905451c6408c68e71d.zip
cpython-bc9d92c67933917b474e61905451c6408c68e71d.tar.gz
cpython-bc9d92c67933917b474e61905451c6408c68e71d.tar.bz2
gh-122858: Deprecate `asyncio.iscoroutinefunction` (#122875)
Deprecate `asyncio.iscoroutinefunction` in favor of `inspect.iscoroutinefunction`. Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Diffstat (limited to 'Lib/asyncio/coroutines.py')
-rw-r--r--Lib/asyncio/coroutines.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/asyncio/coroutines.py b/Lib/asyncio/coroutines.py
index ab4f30e..a51319c 100644
--- a/Lib/asyncio/coroutines.py
+++ b/Lib/asyncio/coroutines.py
@@ -18,7 +18,16 @@ _is_coroutine = object()
def iscoroutinefunction(func):
+ import warnings
"""Return True if func is a decorated coroutine function."""
+ warnings._deprecated("asyncio.iscoroutinefunction",
+ f"{warnings._DEPRECATED_MSG}; "
+ "use inspect.iscoroutinefunction() instead",
+ remove=(3,16))
+ return _iscoroutinefunction(func)
+
+
+def _iscoroutinefunction(func):
return (inspect.iscoroutinefunction(func) or
getattr(func, '_is_coroutine', None) is _is_coroutine)