Issue #29198: add AsyncGenerator (Jelle Zijlstra)
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 @@
# AsyncIterable,
# Coroutine,
# Collection,
- # ContextManager
+ # ContextManager,
+ # AsyncGenerator,
# Structural checks, a.k.a. protocols.
'Reversible',
@@ -1900,6 +1901,13 @@
"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)