Discard partials remaining after inference failure#20126
Merged
ilevkivskyi merged 3 commits intopython:masterfrom Oct 28, 2025
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
Collaborator
Author
|
All primer hits are correct - empty list in sympy, |
Collaborator
Author
|
(cc @JukkaL - you recently authored |
ilevkivskyi
reviewed
Oct 27, 2025
Member
ilevkivskyi
left a comment
There was a problem hiding this comment.
I think this is actually the correct fix (unless @JukkaL disagrees), I however have a suggestion on the fallback behavior.
ilevkivskyi
approved these changes
Oct 27, 2025
Member
ilevkivskyi
left a comment
There was a problem hiding this comment.
LG, couple more comments.
This comment has been minimized.
This comment has been minimized.
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/synchronous/topology.py:114: error: Need type annotation for "_events" [var-annotated]
+ pymongo/synchronous/topology.py:129: error: Item "None" of "_EventListeners | None" has no attribute "publish_topology_opened" [union-attr]
+ pymongo/synchronous/topology.py:148: error: Item "None" of "_EventListeners | None" has no attribute "publish_topology_description_changed" [union-attr]
+ pymongo/synchronous/topology.py:164: error: Item "None" of "_EventListeners | None" has no attribute "publish_server_opened" [union-attr]
+ pymongo/synchronous/topology.py:496: error: Item "None" of "_EventListeners | None" has no attribute "publish_server_description_changed" [union-attr]
+ pymongo/synchronous/topology.py:508: error: Item "None" of "_EventListeners | None" has no attribute "publish_topology_description_changed" [union-attr]
+ pymongo/synchronous/topology.py:575: error: Item "None" of "_EventListeners | None" has no attribute "publish_topology_description_changed" [union-attr]
+ pymongo/synchronous/topology.py:734: error: Item "None" of "_EventListeners | None" has no attribute "publish_topology_description_changed" [union-attr]
+ pymongo/synchronous/topology.py:742: error: Item "None" of "_EventListeners | None" has no attribute "publish_topology_closed" [union-attr]
+ pymongo/asynchronous/topology.py:114: error: Need type annotation for "_events" [var-annotated]
+ pymongo/asynchronous/topology.py:129: error: Item "None" of "_EventListeners | None" has no attribute "publish_topology_opened" [union-attr]
+ pymongo/asynchronous/topology.py:148: error: Item "None" of "_EventListeners | None" has no attribute "publish_topology_description_changed" [union-attr]
+ pymongo/asynchronous/topology.py:164: error: Item "None" of "_EventListeners | None" has no attribute "publish_server_opened" [union-attr]
+ pymongo/asynchronous/topology.py:496: error: Item "None" of "_EventListeners | None" has no attribute "publish_server_description_changed" [union-attr]
+ pymongo/asynchronous/topology.py:508: error: Item "None" of "_EventListeners | None" has no attribute "publish_topology_description_changed" [union-attr]
+ pymongo/asynchronous/topology.py:575: error: Item "None" of "_EventListeners | None" has no attribute "publish_topology_description_changed" [union-attr]
+ pymongo/asynchronous/topology.py:736: error: Item "None" of "_EventListeners | None" has no attribute "publish_topology_description_changed" [union-attr]
+ pymongo/asynchronous/topology.py:744: error: Item "None" of "_EventListeners | None" has no attribute "publish_topology_closed" [union-attr]
sympy (https://github.com/sympy/sympy)
+ sympy/core/add.py:218: error: Need type annotation for "rv" [var-annotated]
|
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16573.
Fixes #3031.
When we infer something with Never as a replacement for a partial type, we cannot ignore that result entirely: if we do that, any use of that variable down the road will still refer to
partial<None>, causing reachability issues and unexpected partials leaks.