typeshed/stdlib/3/typing.pyi lists AsyncGenerator.aclose() as returning an awaitable that evaluates to the yield type of the generator, same as asend() or athrow(). I think it should return an awaitable evaluating to None, based on the definition of close() in PEP 342: (https://www.python.org/dev/peps/pep-0342/#new-generator-method-close)
def close(self):
try:
self.throw(GeneratorExit)
except (GeneratorExit, StopIteration):
pass
else:
raise RuntimeError("generator ignored GeneratorExit")
# Other exceptions are not caught
and the definition of aclose() in PEP 525:
Implement an aclose method on asynchronous generators returning a special awaitable. When awaited it throws a GeneratorExit into the suspended generator and iterates over it until either a GeneratorExit or a StopAsyncIteration occur. This is very similar to what the close() method does to regular Python generators, except that an event loop is required to execute aclose().
and the definition of aclose() in collections.abc.AsyncGenerator:
async def aclose(self):
try:
await self.athrow(GeneratorExit)
except (GeneratorExit, StopAsyncIteration):
pass
else:
raise RuntimeError("asynchronous generator ignored GeneratorExit")
typeshed/stdlib/3/typing.pyilistsAsyncGenerator.aclose()as returning an awaitable that evaluates to the yield type of the generator, same asasend()orathrow(). I think it should return an awaitable evaluating to None, based on the definition ofclose()in PEP 342: (https://www.python.org/dev/peps/pep-0342/#new-generator-method-close)and the definition of
aclose()in PEP 525:and the definition of
aclose()incollections.abc.AsyncGenerator: