From 9469c1c7ead6ffe84d9c16539a674582f267fd72 Mon Sep 17 00:00:00 2001 From: Ganden Schaffner Date: Tue, 23 Aug 2022 06:28:37 -0700 Subject: [PATCH] Make `AsyncExitStack.push_async_exit` support `__aexit__`s returning `Awaitable[None]` (#8596) Make push_async_exit support __aexit__'s returning Awaitable[None] --- stdlib/contextlib.pyi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stdlib/contextlib.pyi b/stdlib/contextlib.pyi index 6a846ad61..00aa7c5ef 100644 --- a/stdlib/contextlib.pyi +++ b/stdlib/contextlib.pyi @@ -148,7 +148,9 @@ class ExitStack(metaclass=abc.ABCMeta): self, __exc_type: type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None ) -> bool: ... -_ExitCoroFunc: TypeAlias = Callable[[type[BaseException] | None, BaseException | None, TracebackType | None], Awaitable[bool]] +_ExitCoroFunc: TypeAlias = Callable[ + [type[BaseException] | None, BaseException | None, TracebackType | None], Awaitable[bool | None] +] _ACM_EF = TypeVar("_ACM_EF", bound=AbstractAsyncContextManager[Any] | _ExitCoroFunc) # In reality this is a subclass of `AbstractAsyncContextManager`;