Fix crash on partially typed namespace package#20742
Open
ilevkivskyi wants to merge 2 commits intopython:masterfrom
Open
Fix crash on partially typed namespace package#20742ilevkivskyi wants to merge 2 commits intopython:masterfrom
ilevkivskyi wants to merge 2 commits intopython:masterfrom
Conversation
This comment has been minimized.
This comment has been minimized.
Contributor
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
This was referenced Feb 5, 2026
|
(FWIW all the evidence pointed to it being the same issue as the reproduction at Qiskit/qiskit-serverless#1787, but for completeness this also resolves all |
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 #16214
Closes #20658
The root cause is similar to the issue fixed by #19044, when there are multiple packages in
googlenamespace, some withpy.typed, some without. As a result, there can be a situation where we first find the untyped one, and mark ancestor (i.e.google) as suppressed, but then we find the typed one and actually add ancestor (i.e.google) to the graph. This creates a situation where we write some references togooglein cache, while it may not be loaded on the warm run, thus causing a crash.My solution is simple: un-suppress namespace ancestors if there is at least one package that needs them, so that the build graph is consistent.
Unfortunately, this uncovers another (pre-existing) bug where
# type: ignores are not handled correctly on warm runs, similar to #20105. In any case, I am going to submit a separate PR for this bug (I think there may be a simple fix for it).