Skip to content

Don't mutate caller's attrs dict in RustWorkXGraph.update_edge_attrs#313

Merged
JoOkuma merged 1 commit into
royerlab:mainfrom
JoOkuma:fix-update-edge-attrs-mutation
Jul 1, 2026
Merged

Don't mutate caller's attrs dict in RustWorkXGraph.update_edge_attrs#313
JoOkuma merged 1 commit into
royerlab:mainfrom
JoOkuma:fix-update-edge-attrs-mutation

Conversation

@JoOkuma

@JoOkuma JoOkuma commented Jul 1, 2026

Copy link
Copy Markdown
Member

Scalar values were broadcast in place (attrs[key] = [value] * size), so the caller's dict was mutated and reusing it with a different edge count raised a bogus wrong-size error.

Broadcast into a local copy, as update_node_attrs already does.

Extended the existing backend test to assert the dict is untouched.

…ttrs

update_edge_attrs wrote the scalar-to-list broadcast back into the
caller's dict ({'w': 1.5} became {'w': [1.5, 1.5]}), so reusing the
same dict for a second call with a different edge count raised a
wrong-size error. update_node_attrs already broadcasts into a local
variable; do the same here.
@JoOkuma JoOkuma merged commit 1da97e0 into royerlab:main Jul 1, 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.

1 participant