Skip to content

Fix NumPy clip with read-only integer bounds - #486

Open
AryanRG wants to merge 1 commit into
data-apis:mainfrom
AryanRG:fix-numpy-clip-readonly-bounds
Open

AryanRG wants to merge 1 commit into
data-apis:mainfrom
AryanRG:fix-numpy-clip-readonly-bounds

Conversation

@AryanRG

@AryanRG AryanRG commented Oct 29, 2026

Copy link
Copy Markdown

NumPy clip raises ValueError: assignment destination is read-only when an integer array is clipped with same-dtype bounds from broadcast_to or an array marked read-only.

Skip the range adjustment when a bound already has the input dtype, since its values are representable. Regression tests cover lower and upper bounds, broadcasted bounds, and out= without changing the bound or input.

Validated the NumPy tests on NumPy 1.26.4 and 2.5.4, plus the local suite with NumPy and Torch. Optional backends were skipped.

This branch has not been deployed

No deployments
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.

1 participant