Skip to content

BUG: use Python integers for repeat slice bounds - #451

Merged
ev-br merged 1 commit into
data-apis:masterfrom
Boulea7:fix-repeat-slice-indices
Aug 12, 2026
Merged

BUG: use Python integers for repeat slice bounds#451
ev-br merged 1 commit into
data-apis:masterfrom
Boulea7:fix-repeat-slice-indices

Conversation

@Boulea7

@Boulea7 Boulea7 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #450. test_repeat now converts each array-valued repeat count to a Python integer before computing slice bounds. This keeps the value check compatible with libraries such as MLX that do not accept 0D arrays as slice indices.

Validation

  • Reproduced the failure with an integer-convertible scalar that does not implement __index__, then confirmed the same path passes after the change
  • ARRAY_API_TESTS_MODULE=array_api_strict .venv/bin/python -m pytest -q array_api_tests/test_manipulation_functions.py::test_repeat --max-examples=1000 --disable-deadline
  • ARRAY_API_TESTS_MODULE=array_api_strict .venv/bin/python -m pytest -q meta_tests (70 passed, 1 skipped)
  • .venv/bin/pre-commit run --all-files

The full manipulation test file also surfaced an unrelated test_reshape failure for an empty array with copy=False; the changed test_repeat passes independently.

@ev-br ev-br left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks

@ev-br
ev-br merged commit 0ec39fe into data-apis:master Aug 12, 2026
5 checks passed
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.

Bug: test_repeat uses the 0 dim array for slicing instead of ints

2 participants