:x: Problematic code:
class ContextManager: def __enter__(self): pass def __exit__(self, *exc): pass async def foo(): async with ContextManager(): pass
:heavy_check_mark: Correct code:
class AsyncContextManager: def __aenter__(self): pass def __aexit__(self, *exc): pass async def foo(): async with AsyncContextManager(): pass
Async context manager doesn't implement __aenter__ and __aexit__. Used when an async context manager is used with an object that does not implement the async context management protocol. This message belongs to the async checker. It can't be emitted when using Python < 3.5.