made fields of builtin objects immutable
authorStefan Behnel <scoder@users.berlios.de>
Fri, 3 Dec 2010 20:17:30 +0000 (21:17 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Fri, 3 Dec 2010 20:17:30 +0000 (21:17 +0100)
Cython/Compiler/ExprNodes.py

index f6966165526f8a89121b8d9a835a877b27135533..d721a69ef06c06575e2d8199a2fd3851f20bf840 100755 (executable)
@@ -3451,7 +3451,9 @@ class AttributeNode(ExprNode):
             if not target:
                 self.is_temp = 1
                 self.result_ctype = py_object_type
-    
+        elif target and self.obj.type.is_builtin_type:
+            error(self.pos, "Assignment to an immutable object field")
+
     def analyse_attribute(self, env, obj_type = None):
         # Look up attribute and set self.type and self.member.
         self.is_py_attr = 0