Repository navigation
ExpertSolver.interpolate: index views as Py_ssize_t, not long - #18
Merged
Merged
Conversation
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>
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.
ExpertSolver.interpolate(mode='nearest')declares its model-index views as Clong, while the array it gets fromscipy.spatial.cKDTree.queryisnp.intp. On Linux and macOS the two are the same width; on Windowslongis 32-bit andintp64-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