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

Fix error for callback protocol matching against callable type object #15042

Merged
merged 2 commits into from
Apr 14, 2023

Conversation

hauntsaninja
Copy link
Collaborator

@hauntsaninja hauntsaninja commented Apr 12, 2023

Fixes #15024

Previously, the message inaccurately compared __call__ to __call__ instead of __new__ or __init__ for type objects

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/ext/commands/converters.py:262: note:     Expected:
+ steam/ext/commands/converters.py:262: note:         def __call__(str, /) -> Any
+ steam/ext/commands/converters.py:262: note:     Got:
+ steam/ext/commands/converters.py:262: note:         def [T_co] __init__() -> Converter[T_co]

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! This makes the error messages much clearer.

@JukkaL JukkaL merged commit 1a47b19 into python:master Apr 14, 2023
@hauntsaninja hauntsaninja deleted the proto-error branch April 14, 2023 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Callables and __init__ methods
2 participants