Skip to content

Commit a5bbb36

Browse files
authored
Ensure keys are sorted when generated CommentedMap from a regular dict. (#72)
1 parent ebdf27d commit a5bbb36

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

schema_salad/sourceline.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ def cmap(d, lc=None, fn=None): # type: (Union[int, float, str, unicode, Dict, L
103103
return d
104104
if isinstance(d, dict):
105105
cm = CommentedMap()
106-
for k,v in d.iteritems():
106+
for k in sorted(d.keys()):
107+
v = d[k]
107108
if isinstance(v, CommentedBase):
108109
uselc = [v.lc.line, v.lc.col, v.lc.line, v.lc.col]
109110
vfn = v.lc.filename if hasattr(v.lc, "filename") else fn

0 commit comments

Comments
 (0)