diff options
| author | Keryn Knight <keryn@kerynknight.com> | 2021-07-26 19:19:38 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-09-20 07:03:10 +0200 |
| commit | e441847ecae99dd1ccd0d9ce76dbcff51afa863c (patch) | |
| tree | 48fe6cd53d698ff59045180d89b1839c42594cfc /django | |
| parent | ef4ef3b8f5e253f009d27952a4e75e008c9d6e5f (diff) | |
Fixed #32970 -- Changed WhereNode.clone() to create a shallow copy of children.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/sql/where.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py index 8b2cc8c046..160d5733b8 100644 --- a/django/db/models/sql/where.py +++ b/django/db/models/sql/where.py @@ -146,12 +146,9 @@ class WhereNode(tree.Node): value) tuples, or objects supporting .clone(). """ clone = self.__class__._new_instance( - children=[], connector=self.connector, negated=self.negated) - for child in self.children: - if hasattr(child, 'clone'): - clone.children.append(child.clone()) - else: - clone.children.append(child) + children=None, connector=self.connector, negated=self.negated, + ) + clone.children = self.children[:] return clone def relabeled_clone(self, change_map): |
