Commit 3353627c authored by Stefan Behnel's avatar Stefan Behnel

generate switch-case characters in sorted order for 'char_val in bytes'

parent 00a5ade4
...@@ -644,7 +644,8 @@ class SwitchTransform(Visitor.VisitorTransform): ...@@ -644,7 +644,8 @@ class SwitchTransform(Visitor.VisitorTransform):
# integers on iteration, whereas Py2 returns 1-char byte # integers on iteration, whereas Py2 returns 1-char byte
# strings # strings
characters = string_literal.value characters = string_literal.value
characters = set([ characters[i:i+1] for i in range(len(characters)) ]) characters = list(set([ characters[i:i+1] for i in range(len(characters)) ]))
characters.sort()
return [ ExprNodes.CharNode(string_literal.pos, value=charval, return [ ExprNodes.CharNode(string_literal.pos, value=charval,
constant_result=charval) constant_result=charval)
for charval in characters ] for charval in characters ]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment