Closed peterschutt closed 4 months ago
[X] I have checked that my issue does not already have a solution in the FAQ
[X] I have searched the existing issues and didn't find my bug already reported there
[X] I have checked that my bug is still present in the latest release
4.0.0a4
Passing an AsyncScheduler instance to AsyncExitStack.enter_async_context results in:
AsyncScheduler
AsyncExitStack.enter_async_context
src/infra/__init__.py:61: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "AsyncScheduler"; expected "AbstractAsyncContextManager[AsyncScheduler]" [arg-type] src/infra/__init__.py:61: note: Following member(s) of "AsyncScheduler" have conflicts: src/infra/__init__.py:61: note: Expected: src/infra/__init__.py:61: note: def __aexit__(self, type[BaseException] | None, BaseException | None, TracebackType | None, /) -> Coroutine[Any, Any, bool | None] src/infra/__init__.py:61: note: Got: src/infra/__init__.py:61: note: def __aexit__(self, type[BaseException], BaseException, TracebackType, /) -> Coroutine[Any, Any, None]
To conform to the ABC the args received by the exit method must be union with None.
None
async with AsyncExitStack() as stack: scheduler = AsyncScheduler() scheduler = await stack.enter_async_context(scheduler)
Things to check first
[X] I have checked that my issue does not already have a solution in the FAQ
[X] I have searched the existing issues and didn't find my bug already reported there
[X] I have checked that my bug is still present in the latest release
Version
4.0.0a4
What happened?
Passing an
AsyncScheduler
instance toAsyncExitStack.enter_async_context
results in:To conform to the ABC the args received by the exit method must be union with
None
.How can we reproduce the bug?