Repository navigation
fix(python): Honor element slices in struct-backed buffer iteration - #1009
Open
peterolkhov wants to merge 1 commit into
Open
peterolkhov wants to merge 1 commit into
peterolkhov wants to merge 1 commit into
Conversation
paleolimbot
approved these changes
Nov 17, 2026
paleolimbot
left a comment
Member
There was a problem hiding this comment.
Thank you!
One slight simplification that I believe is equivalent (but check!)
Comment on lines
+354
to
+355
| view = memoryview(self).cast("B") | ||
| view = view[offset * self.itemsize:(offset + length) * self.itemsize] |
Member
There was a problem hiding this comment.
I think we can just do this?
Suggested change
| view = memoryview(self).cast("B") | |
| view = view[offset * self.itemsize:(offset + length) * self.itemsize] | |
| view = memoryview(self)[offset:(offset + length)] |
This branch has not been deployed
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.
Sliced fixed-width binary, half-float, decimal and interval arrays can currently read earlier values or return extra rows because
CBufferView._iter_struct()ignores its offset and length. Apply those bounds to a byte memoryview before unpacking, preserving the existing scalar and tuple output. Regression tests cover direct buffer slices, empty slices, bounds and lifetime, plus nullable PyArrow Array and RecordBatch conversion.Tested locally on macOS arm64/Python3.14: Python suite (284 passed, 4 skipped), doctests (118 passed), stubtest (8 modules), configured applicable pre-commit hooks and a 56-case external PyArrow matrix. Ubuntu and the full CI Python matrix remain for CI.
The code change and regression tests were prepared with OpenAI Codex assistance (GPT-6.1 Sol).