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

Emit a message for unhashable dict keys #7034

Closed
mbyrnepr2 opened this issue Jun 24, 2022 · 0 comments · Fixed by #7036
Closed

Emit a message for unhashable dict keys #7034

mbyrnepr2 opened this issue Jun 24, 2022 · 0 comments · Fixed by #7036
Labels
Enhancement ✨ Improvement to a component False Negative 🦋 No message is emitted but something is wrong with the code
Milestone

Comments

@mbyrnepr2
Copy link
Member

mbyrnepr2 commented Jun 24, 2022

Current problem

The following example leads to a TypeError because the key is unhashable.
pylint currently emits nothing for this:

{[1, 2, 3]: "tomato"}

Desired solution

Emit a message indicating the TypeError.

Additional context

Noticed this while writing documentation for the unhashable-dict-key checker: #7033 (comment).

Note the existing unhashable-dict-key checker emits a message when the key being looked up is unhashable; not the keys in the dict itself. I.e.:

{"tomato": "red"}[["a", "b", "c"]]  # [unhashable-dict-key]
@mbyrnepr2 mbyrnepr2 added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Jun 24, 2022
@Pierre-Sassoulas Pierre-Sassoulas added False Negative 🦋 No message is emitted but something is wrong with the code Needs decision 🔒 Needs a decision before implemention or rejection Proposal 📨 and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jun 24, 2022
@jacobtylerwalls jacobtylerwalls added this to the 2.15.0 milestone Jun 24, 2022
@DanielNoord DanielNoord added Needs PR This issue is accepted, sufficiently specified and now needs an implementation and removed Proposal 📨 Needs decision 🔒 Needs a decision before implemention or rejection labels Jun 25, 2022
@jacobtylerwalls jacobtylerwalls added the Enhancement ✨ Improvement to a component label Jun 25, 2022
@Pierre-Sassoulas Pierre-Sassoulas removed the Needs PR This issue is accepted, sufficiently specified and now needs an implementation label Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component False Negative 🦋 No message is emitted but something is wrong with the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants