Skip to content

Commit c11dbb5

Browse files
committed
Use OrderedDict for renamed annotations
It works fine with a dict() because since Python 3.5, dicts are ordered. However, that's an implementation detail and we shouldn't rely on that.
1 parent 94faf44 commit c11dbb5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

psqlextra/sql.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from collections import OrderedDict
12
from typing import List, Optional, Tuple
23

34
import django
@@ -54,7 +55,7 @@ def rename_annotations(self, annotations) -> None:
5455
)
5556

5657
# rebuild the annotations according to the original order
57-
new_annotations = dict()
58+
new_annotations = OrderedDict()
5859
for old_name, annotation in self.annotations.items():
5960
new_name = annotations.get(old_name)
6061
new_annotations[new_name or old_name] = annotation

0 commit comments

Comments
 (0)