We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug Report
Hello. Here's something I stumbled upon implementing an asyncio thing. It looks like an issue with ParamSpec and/or generics to me.
To Reproduce
from asyncio import AbstractEventLoop, Task, get_running_loop from contextvars import copy_context loop: AbstractEventLoop = get_running_loop() async def to_run() -> int: return 1 task: Task[int] # Works, correctly: task = loop.create_task(to_run()) # Error, incorrectly: task = copy_context().run(loop.create_task, to_run())
Expected Behavior
The example should type-check.
Actual Behavior
Mypy reports the following:
a02.py:18: error: Argument 1 to "run" of "Context" has incompatible type "Callable[[Union[Coroutine[Any, Any, _T], Generator[Any, None, _T]], DefaultNamedArg(Optional[str], 'name'), DefaultNamedArg(Optional[Context], 'context')], Task[_T]]"; expected "Callable[[Union[Coroutine[Any, Any, _T], Generator[Any, None, _T]], DefaultNamedArg(Optional[str], 'name'), DefaultNamedArg(Optional[Context], 'context')], Task[int]]" [arg-type] a02.py:18: error: Argument 2 to "run" of "Context" has incompatible type "Coroutine[Any, Any, int]"; expected "Union[Coroutine[Any, Any, _T], Generator[Any, None, _T]]" [arg-type] Found 2 errors in 1 file (checked 1 source file)
Your Environment
mypy.ini
The text was updated successfully, but these errors were encountered:
This example works correctly on master with --new-type-inference, likely fixed by #15837
--new-type-inference
Sorry, something went wrong.
No branches or pull requests
Bug Report
Hello. Here's something I stumbled upon implementing an asyncio thing. It looks like an issue with ParamSpec and/or generics to me.
To Reproduce
Expected Behavior
The example should type-check.
Actual Behavior
Mypy reports the following:
Your Environment
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: