1From: Takuto Ikuta <tikuta@chromium.org> 2Date: Mon, 24 May 2021 17:09:21 +0900 3Subject: [PATCH] jinja2: make compiled template deterministic for python3 4 5set() doesn't have deterministic iteration order, so need this to 6have deterministic output from jinja2. 7 8Bug: 1194274 9 10diff -Naur a/compiler.py b/compiler.py 11--- a/compiler.py 2021-10-05 23:41:45.774333282 +0900 12+++ b/compiler.py 2021-10-06 16:46:08.082078686 +0900 13@@ -468,7 +468,7 @@ 14 visitor.visit(node) 15 for dependency in "filters", "tests": 16 mapping = getattr(self, dependency) 17- for name in getattr(visitor, dependency): 18+ for name in sorted(getattr(visitor, dependency)): 19 if name not in mapping: 20 mapping[name] = self.temporary_identifier() 21 self.writeline( 22@@ -612,7 +612,7 @@ 23 def dump_local_context(self, frame): 24 return "{%s}" % ", ".join( 25 "%r: %s" % (name, target) 26- for name, target in iteritems(frame.symbols.dump_stores()) 27+ for name, target in sorted(iteritems(frame.symbols.dump_stores())) 28 ) 29 30 def write_commons(self): 31