Commit 7df9d654 authored by Robert Bradshaw's avatar Robert Bradshaw

Support cpdef void methods.

parent 6c201262
...@@ -80,6 +80,8 @@ Bugs fixed ...@@ -80,6 +80,8 @@ Bugs fixed
* C++ exception declarations with mapping functions could fail to compile when * C++ exception declarations with mapping functions could fail to compile when
pre-declared in .pxd files. pre-declared in .pxd files.
* ``cpdef void`` methods are now permitted.
Other changes Other changes
------------- -------------
......
...@@ -4141,6 +4141,11 @@ class OverrideCheckNode(StatNode): ...@@ -4141,6 +4141,11 @@ class OverrideCheckNode(StatNode):
self.pos, function=self.func_node, self.pos, function=self.func_node,
args=[ ExprNodes.NameNode(self.pos, name=arg.name) args=[ ExprNodes.NameNode(self.pos, name=arg.name)
for arg in self.args[first_arg:] ]) for arg in self.args[first_arg:] ])
if env.return_type.is_void or env.return_type.is_returncode:
self.body = StatListNode(self.pos, stats=[
ExprStatNode(self.pos, expr=call_node),
ReturnStatNode(self.pos, value=None)])
else:
self.body = ReturnStatNode(self.pos, value=call_node) self.body = ReturnStatNode(self.pos, value=call_node)
self.body = self.body.analyse_expressions(env) self.body = self.body.analyse_expressions(env)
return self return self
......
...@@ -15,3 +15,27 @@ cpdef void raisable() except *: ...@@ -15,3 +15,27 @@ cpdef void raisable() except *:
""" """
print('here') print('here')
raise RuntimeError() raise RuntimeError()
cdef class A:
"""
>>> A().foo()
A
"""
cpdef void foo(self):
print "A"
cdef class B(A):
"""
>>> B().foo()
B
"""
cpdef void foo(self):
print "B"
class C(B):
"""
>>> C().foo()
C
"""
def foo(self):
print "C"
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