fix exception type on None error
authorStefan Behnel <scoder@users.berlios.de>
Sun, 7 Nov 2010 09:44:16 +0000 (10:44 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Sun, 7 Nov 2010 09:44:16 +0000 (10:44 +0100)
Cython/Compiler/ExprNodes.py
tests/run/set.pyx

index 5c63ff23dfc2dcfd4bd92d576f5cf8525ed3b41d..1a4ae861fdbe00a831bcc6aa0a88bbc360d42267 100755 (executable)
@@ -2839,7 +2839,8 @@ class SimpleCallNode(CallNode):
                 self_arg = func_type.args[0]
                 if self_arg.not_none: # C methods must do the None test for self at *call* time
                     self.self = self.self.as_none_safe_node(
-                        "'NoneType' object has no attribute '%s'" % self.function.entry.name)
+                        "'NoneType' object has no attribute '%s'" % self.function.entry.name,
+                        'PyExc_AttributeError')
                 expected_type = self_arg.type
                 self.coerced_self = CloneNode(self.self).coerce_to(
                     expected_type, env)
index cf1888653f28d7f8188af657cda69eeb45a6efe6..074345207e58af3cbd066ee8a695b2df735cc8c2 100644 (file)
@@ -60,7 +60,7 @@ def test_set_clear_None():
     """
     >>> test_set_clear_None()
     Traceback (most recent call last):
-    TypeError: 'NoneType' object has no attribute 'clear'
+    AttributeError: 'NoneType' object has no attribute 'clear'
     """
     cdef set s1 = None
     s1.clear()