summaryrefslogtreecommitdiff
path: root/django/db/models/sql/where.py
diff options
context:
space:
mode:
authorNick Pope <nick@nickpope.me.uk>2021-09-20 23:34:24 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-07-27 10:06:24 +0200
commitddf0002bb760e5f1df664a81bd2a554c522f2c0f (patch)
tree9b080c47d111b6d57c7847d626b632934ddd0cb4 /django/db/models/sql/where.py
parentcadd864f6878c1c02a014589876ece166befdeb3 (diff)
Refs #32948 -- Renamed Node._new_instance() to Node.create().
Node._new_instance() was added in 6dd2b5468fa275d53aa60fdcaff8c28bdc5e9c25 to work around Q.__init__() having an incompatible signature with Node.__init__(). It was intended as a hook that could be overridden if subclasses needed to change the behaviour of instantiation of their specialised form of Node. In practice this doesn't ever seem to have been used for this purpose and there are very few calls to Node._new_instance() with other code, e.g. Node.__deepcopy__() calling Node and overriding __class__ as required. Rename this to Node.create() to make it a more "official" piece of private API that we can use to simplify a lot of other areas internally. The docstring and nearby comment have been reworded to read more clearly.
Diffstat (limited to 'django/db/models/sql/where.py')
-rw-r--r--django/db/models/sql/where.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py
index dbfd9a02a4..d3e08cc65e 100644
--- a/django/db/models/sql/where.py
+++ b/django/db/models/sql/where.py
@@ -171,7 +171,7 @@ class WhereNode(tree.Node):
self.children[pos] = child.relabeled_clone(change_map)
def clone(self):
- clone = self.__class__._new_instance(
+ clone = self.__class__.create(
children=None,
connector=self.connector,
negated=self.negated,