Skip to content

Retain None as constraints bottom if no bottoms were provided #19485

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

Conversation

sterliakov
Copy link
Collaborator

Current version replaces None (which indicates "no items") with an empty union (=Uninhabited). This breaks inference in some cases.

Fixes #19483.

Copy link
Contributor

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

jax (https://github.com/google/jax)
- jax/experimental/pallas/ops/gpu/attention_mgpu.py:598: error: Unused "type: ignore" comment  [unused-ignore]
+ jax/experimental/pallas/ops/gpu/attention_mgpu.py:597: error: Unused "type: ignore" comment  [unused-ignore]
- jax/experimental/pallas/ops/gpu/attention_mgpu.py:619: error: Unused "type: ignore" comment  [unused-ignore]
+ jax/experimental/pallas/ops/gpu/attention_mgpu.py:618: error: Unused "type: ignore" comment  [unused-ignore]

@sterliakov
Copy link
Collaborator Author

Looks good, it only shifts the errors to inner contexts.

Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

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

LG, thanks!

Btw, unrelated, but it seems to me the branch in solve.py (new line 317) that says No constraints for type variable is actually unreachable.

@ilevkivskyi ilevkivskyi merged commit f42c936 into python:master Jul 21, 2025
20 checks passed
@sterliakov
Copy link
Collaborator Author

I even noticed that but then forgot again while looking at the changed test... It probably is:)

@hauntsaninja
Copy link
Collaborator

Thank you for fixing!!

hauntsaninja pushed a commit that referenced this pull request Jul 27, 2025
Current version replaces `None` (which indicates "no items") with an
empty union (=`Uninhabited`). This breaks inference in some cases.

Fixes #19483.
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.

1.17.0 regression: dict literals incompatible with Sequence[TypedDict]
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy