From 3353627c0d1a0a88bf465c780246a1c738554184 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 22 Apr 2010 12:27:49 +0200 Subject: [PATCH] generate switch-case characters in sorted order for 'char_val in bytes' --- Cython/Compiler/Optimize.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py index f2d55a69..6d394316 100644 --- a/Cython/Compiler/Optimize.py +++ b/Cython/Compiler/Optimize.py @@ -644,7 +644,8 @@ class SwitchTransform(Visitor.VisitorTransform): # integers on iteration, whereas Py2 returns 1-char byte # strings 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, constant_result=charval) for charval in characters ] -- 2.26.2