Repository navigation
Fix nightly CI: pyright error with numpy 2.5 stubs - #306
Merged
Merged
Conversation
np.isscalar no longer narrows, so np.isfinite(value) saw the full object union. Wrap in np.asarray; behavior is unchanged for scalars.
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.
The scheduled CI has failed since Oct 11 at the Type check step (2 new diagnostics at
pyimr/inference.py:207). numpy is unpinned (>=2.0), and 2.5.4's stubs makenp.isfinite(value)reject the un-narrowednp.isscalarunion. Wrapping innp.asarrayfixes it with identical runtime behavior for scalars.Verified locally with numpy 2.5.4 and pyright 1.1.411:
tools/pyright_baseline.pyreports no new errors, ruff is clean, and the 20 inference tests pass.