Skip to content

Fix nightly CI: pyright error with numpy 2.5 stubs - #306

Merged
sbryngelson merged 1 commit into
masterfrom
fix-pyright-isfinite
Oct 15, 2026
Merged

sbryngelson merged 1 commit into
masterfrom
fix-pyright-isfinite

Conversation

@sbryngelson

Copy link
Copy Markdown
Owner

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 make np.isfinite(value) reject the un-narrowed np.isscalar union. Wrapping in np.asarray fixes it with identical runtime behavior for scalars.

Verified locally with numpy 2.5.4 and pyright 1.1.411: tools/pyright_baseline.py reports no new errors, ruff is clean, and the 20 inference tests pass.

np.isscalar no longer narrows, so np.isfinite(value) saw the full object
union. Wrap in np.asarray; behavior is unchanged for scalars.
@sbryngelson
sbryngelson merged commit 9fb0959 into master Oct 15, 2026
3 checks passed
@sbryngelson
sbryngelson deleted the fix-pyright-isfinite branch October 15, 2026 14:50
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 participant