From: Stefan Behnel Date: Sun, 7 Nov 2010 09:44:16 +0000 (+0100) Subject: fix exception type on None error X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=969258428f2e031b35c06050db09f91c2d09fd56;p=cython.git fix exception type on None error --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 5c63ff23..1a4ae861 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -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) diff --git a/tests/run/set.pyx b/tests/run/set.pyx index cf188865..07434520 100644 --- a/tests/run/set.pyx +++ b/tests/run/set.pyx @@ -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()