Skip to content
New issue

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

[1.7] Regression with decorator on overload #16481

Closed
Dreamsorcerer opened this issue Nov 13, 2023 · 4 comments
Closed

[1.7] Regression with decorator on overload #16481

Dreamsorcerer opened this issue Nov 13, 2023 · 4 comments
Labels
bug mypy got something wrong

Comments

@Dreamsorcerer
Copy link
Contributor

Bug Report

aiomcache/client.py:210:6: error: Argument 1 to "acquire" has incompatible type
"Callable[[FlagClient[_T], Connection, bytes, _U], Coroutine[Any, Any, Union[bytes, _T, _U]]]";
expected
"Callable[[Never, Connection, VarArg(Never), KwArg(Never)], Awaitable[Never]]" 
[arg-type]
        @acquire
         ^
aiomcache/client.py:215:6: error: Argument 1 to "acquire" has incompatible type
"Callable[[FlagClient[_T], Connection, bytes, Optional[_U]], Coroutine[Any, Any, Union[bytes, _T, _U, None]]]";
expected
"Callable[[Never, Connection, VarArg(Never), KwArg(Never)], Awaitable[Never]]" 
[arg-type]
        @acquire
         ^
aiomcache/client.py:215:6: error: Overloaded function implementation does not
accept all possible arguments of signature 1  [misc]
        @acquire
         ^

https://github.com/aio-libs/aiomcache/actions/runs/6854046166/job/18636163359?pr=359

For some reason, the errors only appear on 1 method, despite the decorator being used in a similar way on several other methods. Which means it's probably difficult to get a minimal reproducer, though the project itself is pretty small.

To Reproduce

Checkout: aio-libs/aiomcache#359
Run: mypy

@AlexWaygood
Copy link
Member

Fixed earlier today in fbb77c3

@AlexWaygood AlexWaygood closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2023
@AlexWaygood
Copy link
Member

@hauntsaninja, would it be worth it to add aiomemcache to mypy_primer?

@Dreamsorcerer
Copy link
Contributor Author

I did also mention some other candidates before, which included aiohttp-admin which is also seeing a regression (#16482):
#15489 (comment)

@Dreamsorcerer
Copy link
Contributor Author

I highlighted aiohttp-admin as it is doing a lot of introspection on sqlalchemy, so it probably has some interesting edge cases for typing that not many other projects will see. The other libraries I mentioned are all very small, so shouldn't add much overhead, but also strictly typed, so there's a chance they may find a regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

2 participants