Fix switch optimization for attributes
authorRobert Bradshaw <robertwb@math.washington.edu>
Tue, 21 Oct 2008 22:47:41 +0000 (15:47 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Tue, 21 Oct 2008 22:47:41 +0000 (15:47 -0700)
Cython/Compiler/Optimize.py

index 2e4641497e4fa4e685b0b2f6f8e32368169e49fa..84f7d4e3ad1bc8deacc3fefe5753c1c47f86fa64 100644 (file)
@@ -14,7 +14,7 @@ def is_common_value(a, b):
     if isinstance(a, ExprNodes.NameNode) and isinstance(b, ExprNodes.NameNode):
         return a.name == b.name
     if isinstance(a, ExprNodes.AttributeNode) and isinstance(b, ExprNodes.AttributeNode):
-        return not a.is_py_attr and is_common_value(a.obj, b.obj)
+        return not a.is_py_attr and is_common_value(a.obj, b.obj) and a.attribute == b.attribute
     return False