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

Add __hash__ stub to classes that are hashable and define __eq__ #10425

Closed
wants to merge 2 commits into from
Closed

Add __hash__ stub to classes that are hashable and define __eq__ #10425

wants to merge 2 commits into from

Conversation

TheTripleV
Copy link

Fixes #10424.

I only checked the types in builtins.pyi

@github-actions
Copy link
Contributor

github-actions bot commented Jul 9, 2023

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

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/templating.py:132: error: Incompatible types in assignment (expression has type "str", variable has type "dict[Any, Any]")  [assignment]
- src/prefect/utilities/templating.py:134: error: Incompatible types in assignment (expression has type "str", variable has type "dict[Any, Any]")  [assignment]
- src/prefect/utilities/templating.py:282: error: Incompatible types in assignment (expression has type "str", variable has type "dict[Any, Any]")  [assignment]
- src/prefect/utilities/templating.py:284: error: Incompatible types in assignment (expression has type "str", variable has type "dict[Any, Any]")  [assignment]

@AlexWaygood
Copy link
Member

Thanks! Since #8465 didn't fix any known problems, however (just fixed some stylistic nits that we had), I'm inclined to revert the whole PR: see #10426. You're right that we missed this important detail of Python's semantics when it comes to determining whether an object is hashable or not :-)

JelleZijlstra pushed a commit that referenced this pull request Jul 9, 2023
…10426)

Reverts #8465
Fixes #10424
Closes #10425

#8465 caused regressions: see #10424 and python/mypy#13800. Since it didn't fix any known problems (just some stylistic nits that we had), let's just revert the PR.
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.

Builtins are incorrectly hinted as unhashable
2 participants