Skip to content

Improve interaction between --local-partial-types and hashability#20719

Merged
hauntsaninja merged 4 commits into
python:masterfrom
hauntsaninja:localpartialhash
Feb 2, 2026
Merged

Improve interaction between --local-partial-types and hashability#20719
hauntsaninja merged 4 commits into
python:masterfrom
hauntsaninja:localpartialhash

Conversation

@hauntsaninja

@hauntsaninja hauntsaninja commented Feb 2, 2026

Copy link
Copy Markdown
Collaborator

Without this, we would reveal list[Hashable] in the test case

This isn't a great fix though...

@hauntsaninja hauntsaninja marked this pull request as draft February 2, 2026 05:36
@hauntsaninja hauntsaninja force-pushed the localpartialhash branch 2 times, most recently from 59da668 to c5b4ccd Compare February 2, 2026 05:43
@hauntsaninja hauntsaninja marked this pull request as ready for review February 2, 2026 05:57
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@JukkaL JukkaL left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It's a bit ad hoc, but seems benign enough.

Comment thread mypy/checker.py
is_lvalue_member=isinstance(lvalue, MemberExpr),
)
and not (
self.scope.active_class()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Add comment briefly explaining the special case. This could seem mysterious.

@hauntsaninja hauntsaninja merged commit 6fa04e4 into python:master Feb 2, 2026
4 of 38 checks passed
@hauntsaninja hauntsaninja deleted the localpartialhash branch February 2, 2026 20:23
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.

2 participants