Skip to content

nt/ndarray: don't mutate caller's attrib dict in NTNDArray.wrap#219

Open
jacquelinegarrahan wants to merge 1 commit into
epics-base:masterfrom
jacquelinegarrahan:fix/ndarray-attrib-aliasing
Open

nt/ndarray: don't mutate caller's attrib dict in NTNDArray.wrap#219
jacquelinegarrahan wants to merge 1 commit into
epics-base:masterfrom
jacquelinegarrahan:fix/ndarray-attrib-aliasing

Conversation

@jacquelinegarrahan

Copy link
Copy Markdown

wrap() bound attrib directly to the array's own .attrib dict when it was
non-empty, then wrote attrib['ColorMode'] = ... into it. Wrapping an
ntndarray thus injected ColorMode back into the caller's object, and wrapping
the same array twice saw the earlier injection. Copy into a fresh dict before
mutating.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

wrap() bound `attrib` directly to the array's own `.attrib` dict when it was
non-empty, then wrote `attrib['ColorMode'] = ...` into it. Wrapping an
ntndarray thus injected ColorMode back into the caller's object, and wrapping
the same array twice saw the earlier injection. Copy into a fresh dict before
mutating.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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