Commit 96925842 authored by Stefan Behnel's avatar Stefan Behnel

fix exception type on None error

parent fd11571a
...@@ -2839,7 +2839,8 @@ class SimpleCallNode(CallNode): ...@@ -2839,7 +2839,8 @@ class SimpleCallNode(CallNode):
self_arg = func_type.args[0] self_arg = func_type.args[0]
if self_arg.not_none: # C methods must do the None test for self at *call* time 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( 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 expected_type = self_arg.type
self.coerced_self = CloneNode(self.self).coerce_to( self.coerced_self = CloneNode(self.self).coerce_to(
expected_type, env) expected_type, env)
......
...@@ -60,7 +60,7 @@ def test_set_clear_None(): ...@@ -60,7 +60,7 @@ def test_set_clear_None():
""" """
>>> test_set_clear_None() >>> test_set_clear_None()
Traceback (most recent call last): Traceback (most recent call last):
TypeError: 'NoneType' object has no attribute 'clear' AttributeError: 'NoneType' object has no attribute 'clear'
""" """
cdef set s1 = None cdef set s1 = None
s1.clear() s1.clear()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment