FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix nondeterministic type checking by making join with explicit Protocol and type promotion commute by hauntsaninja · Pull Request #18402 · python/mypy · GitHub

Repository navigation

Fix nondeterministic type checking by making join with explicit Protocol and type promotion commute - #18402

Merged
hauntsaninja merged 8 commits into
python:masterfrom
hauntsaninja:nondet
Jun 1, 2025
Merged

hauntsaninja merged 8 commits into
python:masterfrom
hauntsaninja:nondet

Conversation

hauntsaninja commented Jan 1, 2025 •
edited
Loading

Copy link
Copy Markdown
Collaborator

Fixes #16979 (bzoracler case only, OP case fixed by #19147)

See #16979 (comment)

hauntsaninja marked this pull request as draft January 1, 2025 22:01
hauntsaninja marked this pull request as ready for review May 25, 2025 22:51

This comment has been minimized.

Copy link
Copy Markdown
Collaborator Author

Hmm, false positive is because Collection actually has a long MRO. But the length of a protocol MRO doesn't really mean anything. So I will just change is_better

This comment has been minimized.

hauntsaninja changed the title Fix nondeterministic type checking involving noncommutative join Fix nondeterministic type checking by making join with explicit Protocol and type promotion commute May 26, 2025

Copy link
Copy Markdown
Collaborator Author

cc @JukkaL one more nondeterminism PR!

hauntsaninja added a commit that referenced this pull request May 28, 2025
#19147)

I thought about doing this in `join_type_list`, but most callers look
like they do have some deterministic order.

Fixes #19121 (torchvision case only, haven't looked at xarray)

Fixes #16979 (OP case only, bzoracler case fixed by #18402)

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks! Looks good overall, though the logic is getting pretty hard to follow. Left some comments about tests.

github-actions Bot commented Jun 1, 2025

Copy link
Copy Markdown
Contributor

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

nox (https://github.com/wntrblm/nox): 1.46x slower (24.6s -> 35.9s in single noisy sample)

typeshed-stats (https://github.com/AlexWaygood/typeshed-stats): 1.57x slower (60.7s -> 95.0s in single noisy sample)

hauntsaninja merged commit 0ea8488 into python:master Jun 1, 2025
hauntsaninja deleted the nondet branch June 1, 2025 01:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

MyPy is nondeterministic across runs

2 participants


Back | FazBrowse Home | New Git URL