summaryrefslogtreecommitdiff
path: root/Lib/typing.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2017-01-18 13:10:36 -0800
committerGuido van Rossum <guido@python.org>2017-01-18 13:10:36 -0800
commitc75340a8fda52007855ca143513d2252c8cb1574 (patch)
treea42b156e15813c1bc21576c819191a6add6ef555 /Lib/typing.py
parentfa025f112f7467b124f7ac4be5e9c7bb3cc05ad8 (diff)
parent38a49bec7a2522773f907bcee76d5b1305ef2260 (diff)
downloadcpython-git-c75340a8fda52007855ca143513d2252c8cb1574.tar.gz
Issue #29198: add AsyncGenerator (Jelle Zijlstra) (3.6->3.7)
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 0aeb089d5d..00ef440101 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)