BUG: IntervalTree raises on 32-bit when n_elements > leaf_size (GH#44075)#66029
Merged
Conversation
…075) PyArray_Take requires intp indices; the int64 positions we build failed the safe int64->int32 cast on 32-bit platforms when the tree recursed (>100 intervals), surfacing via pd.cut. Cast positions to intp in take. This lets us drop the 32-bit/WASM skip+xfail workarounds added for GH#23440. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
closes #44075
Also closes GH-23440 (same root cause).
Building the
IntervalTreeengine for anIntervalIndexwith more thanleaf_size(100) intervals raisedTypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'on 32-bit platforms — surfacing in the wild via :func:cut.takepasses int64 position arrays toPyArray_Take, which requiresintp; on 32-bitintpis int32 and the safe cast is rejected. It only triggered on the recursive (non-leaf) path, which is why >100 bins failed but ≤100 worked.Fix casts the positions to
intpintake(a no-op on 64-bit, whereintpis int64). This also lets us drop the 32-bitskipif/WASMxfailworkarounds that were added for GH-23440, so those tests now run on the 32-bit CI.