Skip to content

Keep patched values independent of the diff - #206

Open
vitalivo wants to merge 1 commit into
inveniosoftware:masterfrom
vitalivo:fix/patch-independent-values
Open

vitalivo wants to merge 1 commit into
inveniosoftware:masterfrom
vitalivo:fix/patch-independent-values

Conversation

@vitalivo

Copy link
Copy Markdown

Fixes #205.

patch() inserts mutable ADD and CHANGE values directly from the diff. Mutating the patched result can therefore alter the saved diff, so applying it again produces a different result. Deep-copy inserted and replacement values, including when in_place=True (which permits modifying the destination, not the diff).

Four regression cases fail before the fix and pass afterward. bash run-tests.sh passes on Python 3.12: 130 tests/checks, 100% coverage, documentation builds and style checks.

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.

Patching shares mutable values with the input diff

1 participant