summaryrefslogtreecommitdiffstats
path: root/Lib/typing.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2017-01-18 21:10:31 (GMT)
committerGuido van Rossum <guido@python.org>2017-01-18 21:10:31 (GMT)
commite9ed560fcec8d2d1f9705e93049cdb3790d40838 (patch)
tree1f0bca19696f5d9735bf36e4ceb97e4bd190a55f /Lib/typing.py
parent3c268be885d62b1b5ac572340641024af2c02ce4 (diff)
downloadcpython-e9ed560fcec8d2d1f9705e93049cdb3790d40838.zip
cpython-e9ed560fcec8d2d1f9705e93049cdb3790d40838.tar.gz
cpython-e9ed560fcec8d2d1f9705e93049cdb3790d40838.tar.bz2
Issue #29198: add AsyncGenerator (Jelle Zijlstra)
Diffstat (limited to 'Lib/typing.py')
-rw-r--r--Lib/typing.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/typing.py b/Lib/typing.py
index 0aeb089..00ef440 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -51,7 +51,8 @@ __all__ = [
# AsyncIterable,
# Coroutine,
# Collection,
- # ContextManager
+ # ContextManager,
+ # AsyncGenerator,
# Structural checks, a.k.a. protocols.
'Reversible',
@@ -1900,6 +1901,13 @@ class Generator(Iterator[T_co], Generic[T_co, T_contra, V_co],
"create a subclass instead")
return _generic_new(_G_base, cls, *args, **kwds)
+if hasattr(collections_abc, 'AsyncGenerator'):
+ class AsyncGenerator(AsyncIterator[T_co], Generic[T_co, T_contra],
+ extra=collections_abc.AsyncGenerator):
+ __slots__ = ()
+
+ __all__.append('AsyncGenerator')
+
# Internal type variable used for Type[].
CT_co = TypeVar('CT_co', covariant=True, bound=type)