summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Charette <charettes@users.noreply.github.com>2020-03-02 02:42:06 -0500
committerGitHub <noreply@github.com>2020-03-02 08:42:06 +0100
commitdaaa894960e1b2bce8ee31b7c109be84f598a84e (patch)
tree06713c1bbe2c9d5636cf2233536e9be2edc96a77
parenta49c2b6bf098eb48c07641f60dba9be78c6cc92f (diff)
downloaddjango-daaa894960e1b2bce8ee31b7c109be84f598a84e.tar.gz
Refs #26064 -- Avoided unnecessary list slicing in migration optimizer.
The in_between list is only necessary if an optimization is possible.
-rw-r--r--django/db/migrations/optimizer.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/migrations/optimizer.py b/django/db/migrations/optimizer.py
index d1b9d8a031..f66a318d8a 100644
--- a/django/db/migrations/optimizer.py
+++ b/django/db/migrations/optimizer.py
@@ -45,9 +45,9 @@ class MigrationOptimizer:
right = True # Should we reduce on the right or on the left.
# Compare it to each operation after it
for j, other in enumerate(operations[i + 1:]):
- in_between = operations[i + 1:i + j + 1]
result = operation.reduce(other, app_label)
if isinstance(result, list):
+ in_between = operations[i + 1:i + j + 1]
if right:
new_operations.extend(in_between)
new_operations.extend(result)