Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
7df9d654
Commit
7df9d654
authored
Jun 24, 2015
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support cpdef void methods.
parent
6c201262
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
1 deletion
+32
-1
CHANGES.rst
CHANGES.rst
+2
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+6
-1
tests/run/cpdef.pyx
tests/run/cpdef.pyx
+24
-0
No files found.
CHANGES.rst
View file @
7df9d654
...
...
@@ -80,6 +80,8 @@ Bugs fixed
* C++ exception declarations with mapping functions could fail to compile when
pre-declared in .pxd files.
* ``cpdef void`` methods are now permitted.
Other changes
-------------
...
...
Cython/Compiler/Nodes.py
View file @
7df9d654
...
...
@@ -4141,7 +4141,12 @@ class OverrideCheckNode(StatNode):
self
.
pos
,
function
=
self
.
func_node
,
args
=
[
ExprNodes
.
NameNode
(
self
.
pos
,
name
=
arg
.
name
)
for
arg
in
self
.
args
[
first_arg
:]
])
self
.
body
=
ReturnStatNode
(
self
.
pos
,
value
=
call_node
)
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
=
self
.
body
.
analyse_expressions
(
env
)
return
self
...
...
tests/run/cpdef.pyx
View file @
7df9d654
...
...
@@ -15,3 +15,27 @@ cpdef void raisable() except *:
"""
print
(
'here'
)
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"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment