Skip to content

Raise IndexError for integer-indexed writes to scalar variables - #1532

Merged
jswhit merged 1 commit into
masterfrom
fix_scalarvar_writes
Dec 1, 2026
Merged

jswhit merged 1 commit into
masterfrom
fix_scalarvar_writes

Conversation

@jswhit

@jswhit jswhit commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Assigning to a scalar variable with an integer index (e.g. v[0] = val) previously succeeded for some indices and failed for others. Now it consistently raises IndexError, as numpy does for 0-d arrays. Use v[...] = val, v[()] = valor v.assignValue(val) instead (issue #1531). v[:]=val also allowed to avoid breaking existing code, since it was before.

Assigning to a scalar variable with an integer index (e.g. v[0] = val)
previously succeeded for some indices and failed for others. Now it
consistently raises IndexError, as numpy does for 0-d arrays. Use
v[...] = val, v[()] = val or v.assignValue(val) instead (issue #1531).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jswhit
jswhit merged commit c9aaf8f into master Dec 1, 2026
53 of 55 checks passed
@jswhit
jswhit deleted the fix_scalarvar_writes branch December 1, 2026 15:13
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