Skip to content

Commit ada220a

Browse files
waltsimsclaude
andcommitted
Shallow-copy source dict in _f_to_c_source_reorder to avoid mutation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6d5e80c commit ada220a

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

kwave/solvers/kspace_solver.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@ def _f_to_c_source_reorder(source, grid_shape):
789789
ndim = len(grid_shape)
790790
if ndim < 2:
791791
return source
792+
source = dict(source) # shallow copy — don't mutate caller's dict
792793

793794
for mask_key, signal_keys in [("p_mask", ["p"]), ("u_mask", ["ux", "uy", "uz"])]:
794795
mask_raw = source.get(mask_key)

0 commit comments

Comments
 (0)