Skip to content

Builtins are incorrectly hinted as unhashable #10424

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

Closed
TheTripleV opened this issue Jul 9, 2023 · 0 comments · Fixed by #10426
Closed

Builtins are incorrectly hinted as unhashable #10424

TheTripleV opened this issue Jul 9, 2023 · 0 comments · Fixed by #10426

Comments

@TheTripleV
Copy link

TheTripleV commented Jul 9, 2023

I believe this was partially introduced by #8465. I ran into this issue while looking into microsoft/pyright#5446.

According to the python docs, a type that redefines __eq__ but not __hash__ is unhashable.

In the current typeshed hints, many types explicitly define __eq__ (int for example) but do not define hash. A type checker could incorrectly assume that the type is unhashable because of this.

JelleZijlstra pushed a commit that referenced this issue 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
1 participant