Attempt to narrow tuple.__hash__ to flag unhashable entries in the tuple#15852
Attempt to narrow tuple.__hash__ to flag unhashable entries in the tuple#15852jonathandung wants to merge 6 commits into
tuple.__hash__ to flag unhashable entries in the tuple#15852Conversation
This comment has been minimized.
This comment has been minimized.
|
That was somewhat surprising. |
|
Could you add some tests to Important: The tests are never run, only type checked, so they don't need to be runnable, and should skip unnecessary setup etc. |
|
Both tuples and hashing are special-cased by type checkers so it's not entirely surprising that this appears to do nothing to mypy. Worth checking what we do to other type checkers, though. |
|
I'll do an experimental PR to ty to see what it does to us. Edit: testing this in astral-sh/ruff#25526 |
|
The experiment gave a clean ecosystem report for ty (again, somewhat surprising 😄): astral-sh/ruff#25526 (comment). There are a few failing tests on that PR but they're nothing to worry about -- just snapshots that would need to be updated. |
|
If it doesn't do anything then that also means there's little reason to make this change, though. |
|
I think after merging #15754 (if ever), some errors are sure to emerge |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Closes #15851.