Make AsyncExitStack.push_async_exit support __aexit__s returning Awaitable[None] (#8596)

Make push_async_exit support __aexit__'s returning Awaitable[None]
This commit is contained in:
Ganden Schaffner
2022-08-23 06:28:37 -07:00
committed by GitHub
parent 875f0ca7fc
commit 9469c1c7ea

View File

@@ -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`;