mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #29198: add AsyncGenerator (Jelle Zijlstra)
This commit is contained in:
parent
3c268be885
commit
e9ed560fce
2 changed files with 51 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue