-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
Note: if you are reporting a wrong signature of a function or a class in
the standard library, then the typeshed tracker is better suited
for this report: https://github.com/python/typeshed/issues
Please provide more information to help us understand the issue:
- Are you reporting a bug, or opening a feature request?
Reporting a bug.
- Please insert below the code you are checking with mypy,
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
from typing import Generic, AsyncContextManager, TypeVar
T_Item = TypeVar('T_Item', str, int)
class Foo(Generic[T_Item]):
async def foo(self, manager: AsyncContextManager):
async with manager:
pass
Strangely, removing the typevar constraints makes the problem go away.
- What is the actual behavior/output?
bug.py:7: error: "AsyncContextManager[Any]" has no attribute "__enter__"; maybe "__aenter__"?
bug.py:7: error: "AsyncContextManager[Any]" has no attribute "__exit__"; maybe "__aexit__"?
- What is the behavior/output you expect?
No errors.
- What are the versions of mypy and Python you are using?
Do you see the same issue after installing mypy from Git master?
Mypy 0.782.
Yes, this also happens with master (7938f5d).
- What are the mypy flags you are using? (For example --strict-optional)
No flags used.
Metadata
Metadata
Assignees
Labels
No labels