Skip to content

ExpertSolver.interpolate: index views as Py_ssize_t, not long - #18

Merged
Technologicat merged 2 commits into
masterfrom
windows-intp
Oct 7, 2026
Merged

Technologicat merged 2 commits into
masterfrom
windows-intp

Conversation

@Technologicat

Copy link
Copy Markdown
Owner

ExpertSolver.interpolate(mode='nearest') declares its model-index views as C long, while the array it gets from scipy.spatial.cKDTree.query is np.intp. On Linux and macOS the two are the same width; on Windows long is 32-bit and intp 64-bit, so the view should refuse the array.

The first commit adds a test only, to see the Windows runner fail on it; the fix follows on this branch.

🤖 Generated with Claude Code

Technologicat and others added 2 commits October 7, 2026 16:25
Nothing exercised it: test_interp covers `interpolate_fit`. The model
indices it returns and accepts are what cKDTree.query returns, `np.intp`,
which on Windows is wider than the C `long` the views are declared as.
Expected to fail on the Windows runner until the views are fixed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The model-index views were C `long`, while cKDTree.query returns `np.intp`
and `I_out` was allocated as `np.int_`. On Windows `long` is 32-bit and
both of those are 64-bit, so `mode='nearest'` raised "Buffer dtype
mismatch, expected 'long' but got 'long long'" there — seen on the Windows
runner with the previous commit's test. `Py_ssize_t` views and an `np.intp`
allocation match on every platform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Technologicat
Technologicat merged commit a7c6764 into master Oct 7, 2026
13 checks passed
@Technologicat
Technologicat deleted the windows-intp branch October 7, 2026 13:41
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