Skip to content

[1.7] Regression with decorator on overload #16481

Closed as not planned
Closed as not planned

Description

@Dreamsorcerer

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

Activity

  1. AlexWaygood commented on Nov 13, 2023

    @AlexWaygood
    Member

    Fixed earlier today in fbb77c3

  2. AlexWaygood commented on Nov 13, 2023

    @AlexWaygood
    Member

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

  3. Dreamsorcerer commented on Nov 13, 2023

    @Dreamsorcerer
    ContributorAuthor

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

  4. Dreamsorcerer commented on Nov 13, 2023

    @Dreamsorcerer
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions