summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-09-09 05:01:51 (GMT)
committerYury Selivanov <yury@magic.io>2016-09-09 05:01:51 (GMT)
commiteb6364557f9bc4e6be29bb8a8f43308a0e080aba (patch)
tree05b7aed24dce255be67e7a60c021c319d13f43c9 /Lib/inspect.py
parentb96ef55d493aded2dea18b0208070bdfab4ceb73 (diff)
downloadcpython-eb6364557f9bc4e6be29bb8a8f43308a0e080aba.zip
cpython-eb6364557f9bc4e6be29bb8a8f43308a0e080aba.tar.gz
cpython-eb6364557f9bc4e6be29bb8a8f43308a0e080aba.tar.bz2
Issue #28003: Implement PEP 525 -- Asynchronous Generators.
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 72c1691..2380095 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -185,6 +185,13 @@ def iscoroutinefunction(object):
return bool((isfunction(object) or ismethod(object)) and
object.__code__.co_flags & CO_COROUTINE)
+def isasyncgenfunction(object):
+ return bool((isfunction(object) or ismethod(object)) and
+ object.__code__.co_flags & CO_ASYNC_GENERATOR)
+
+def isasyncgen(object):
+ return isinstance(object, types.AsyncGeneratorType)
+
def isgenerator(object):
"""Return true if the object is a generator.