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

singledispatchmethod decorated method fails with unknown method register #13282

Open
stj opened this issue Jul 29, 2022 · 0 comments
Open

singledispatchmethod decorated method fails with unknown method register #13282

stj opened this issue Jul 29, 2022 · 0 comments
Labels
bug mypy got something wrong

Comments

@stj
Copy link

stj commented Jul 29, 2022

I played with an update of mypy from 0.931 to 0.971. The new version fails with error: "Callable[..., bool]" has no attribute "register"
The code is written oddly because of known Python issue https://bugs.python.org/issue41987 , the interpreter has no issue with it.

from functools import singledispatchmethod

class Issue:
  @singledispatchmethod
  def __contains__(self, other) -> bool:
      return True

@Issue.__contains__.register
def _(self, other: Issue) -> bool:
    return False
$ mypy issue.py
issue.py:12: error: "Callable[..., bool]" has no attribute "register"
Found 1 error in 1 file (checked 1 source file)
@stj stj added the bug mypy got something wrong label Jul 29, 2022
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

1 participant