Skip to content

Fix embedded instance deepcopy#2545

Merged
bagerard merged 4 commits intoMongoEngine:masterfrom
bagerard:fix_embedded_instance_deepcopy
Aug 7, 2021
Merged

Fix embedded instance deepcopy#2545
bagerard merged 4 commits intoMongoEngine:masterfrom
bagerard:fix_embedded_instance_deepcopy

Conversation

@bagerard
Copy link
Copy Markdown
Collaborator

@bagerard bagerard commented Aug 2, 2021

This is based on #2495 , it's a slightly modified version

I decided to set _instance to None instead of its initial value because I don't see why we would want the deepcopy of an EmbeddedDoc to point to the initial parent Document and it may create some weird bugs.

I believe it's safer that the deepcopied instance isn't attached to any parent Document, like it is when it is instantiated

@bagerard bagerard force-pushed the fix_embedded_instance_deepcopy branch from 71d85af to 66978ae Compare August 2, 2021 20:09
@bagerard bagerard merged commit bb9ba73 into MongoEngine:master Aug 7, 2021
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.

2 participants