Document that produce() drafts must stay a tree, not a graph#58
Merged
Conversation
Neither docs/guide/gotchas.md nor docs/guide/produce.md mentioned what happens when the same object is reachable from two locations in a draft. Verified against actual behavior and documented two distinct failure modes: - The default (copy) mode silently de-aliases pre-existing shared references in the base object -- even with a no-op recipe, result[a] and result[b] stop being the same object. - in_place=True preserves identity, but the recorded patches still only capture what each proxy independently observes, so replaying patches against a non-aliased copy (e.g. after a JSON round-trip) silently drops writes made through the other alias. Also notes that reference cycles aren't detected and lead to unbounded recursion rather than a clean error. Both code examples in the new section are executed against the library and their assertions verified to pass.
Collaborator
Author
|
I figured that this requirement would be good to mention in the docs somewhere. |
Collaborator
|
Does this limitation also apply to diff? |
Collaborator
Author
|
I don't think so, since with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Neither docs/guide/gotchas.md nor docs/guide/produce.md mentioned what happens when the same object is reachable from two locations in a draft. Verified against actual behavior and documented two distinct failure modes:
Also notes that reference cycles aren't detected and lead to unbounded recursion rather than a clean error.
Both code examples in the new section are executed against the library and their assertions verified to pass.