-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Enhancement ✨Improvement to a componentImprovement to a componentNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation
Milestone
Description
Bug description
# repro.py
# inspired by:
# https://docs.python.org/3/library/contextlib.html#contextlib.asynccontextmanager
import time
from contextlib import asynccontextmanager
@asynccontextmanager
async def timeit():
now = time.monotonic()
try:
yield
finally:
print(f'it took {time.monotonic() - now}s to run')
with timeit():
print('hello world')
Configuration
Command used
pylint repro.py
Pylint output
repro.py:14:0: E1129: Context manager 'async_generator' doesn't implement __enter__ and __exit__. (not-context-manager)
Expected behavior
No error.
Pylint version
pylint 3.3.1
astroid 3.3.10
Python 3.12.2 (main, Feb 25 2024, 04:38:01) [Clang 17.0.6 ]
OS / Environment
No response
Additional dependencies
Metadata
Metadata
Assignees
Labels
Enhancement ✨Improvement to a componentImprovement to a componentNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation