Skip to content

Fix exception for multi-dimensional indexing on buffers#396

Merged
skallweitNV merged 4 commits intomainfrom
dev/bbitterli/buffer-index-fix
Aug 4, 2025
Merged

Fix exception for multi-dimensional indexing on buffers#396
skallweitNV merged 4 commits intomainfrom
dev/bbitterli/buffer-index-fix

Conversation

@tunabrain
Copy link
Collaborator

Buffer indexing fails when indexing with multiple indices (e.g. buffer[3, 4]), because stridedbufferview expects these to be passed as *args. However, python groups them into a tuple instead, and nanobind passes it through as nb::args(nb::tuple(3, 4)) causing an exception during indexing.

This adds a fix, modifies the tests to catch this and adds a better error message.

@tunabrain tunabrain requested a review from a team as a code owner July 31, 2025 22:47
Copy link
Contributor

@skallweitNV skallweitNV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@skallweitNV skallweitNV merged commit 7c88406 into main Aug 4, 2025
15 checks passed
@skallweitNV skallweitNV deleted the dev/bbitterli/buffer-index-fix branch August 4, 2025 16:19
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.

2 participants