fix switch transform
authorStefan Behnel <scoder@users.berlios.de>
Tue, 20 Oct 2009 19:16:12 +0000 (21:16 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Tue, 20 Oct 2009 19:16:12 +0000 (21:16 +0200)
Cython/Compiler/ExprNodes.py

index 58e7878f7a59c16486789903a55a362bdf1be21a..d61d36de767922bc0706f5c283b93aecd217c2e7 100644 (file)
@@ -5168,6 +5168,11 @@ class CmpNode(object):
         error(self.pos, "Invalid types for '%s' (%s, %s)" %
               (op, operand1.type, operand2.type))
 
+    def is_python_comparison(self):
+        return (self.has_python_operands()
+                or (self.cascade and self.cascade.is_python_comparison())
+                or self.operator in ('in', 'not_in'))
+
     def coerce_operands_to(self, dst_type, env):
         operand2 = self.operand2
         if operand2.type != dst_type: