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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
4c3229fe
Commit
4c3229fe
authored
6 years ago
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.28.x'
parents
366b16c6
c48d7bb7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
24 deletions
+24
-24
tests/run/pure_py.py
tests/run/pure_py.py
+15
-15
tests/run/pure_py3.py
tests/run/pure_py3.py
+9
-9
No files found.
tests/run/pure_py.py
View file @
4c3229fe
...
...
@@ -220,6 +220,10 @@ def test_declare_c_types(n):
@
cython
.
ccall
@
cython
.
returns
(
cython
.
double
)
def
c_call
(
x
):
return
x
def
call_ccall
(
x
):
"""
Test that a declared return type is honoured when compiled.
...
...
@@ -235,10 +239,6 @@ def c_call(x):
>>> (is_compiled and 1) or result
1
"""
return
x
def
call_ccall
(
x
):
ret
=
c_call
(
x
)
return
ret
,
cython
.
typeof
(
ret
)
...
...
@@ -247,9 +247,13 @@ def call_ccall(x):
@
cython
.
inline
@
cython
.
returns
(
cython
.
double
)
def
cdef_inline
(
x
):
return
x
+
1
def
call_cdef_inline
(
x
):
"""
>>> result, return_type = call_cdef_inline(1)
>>> (not is_compiled and 'float') or type(re
turn_type
).__name__
>>> (not is_compiled and 'float') or type(re
sult
).__name__
'float'
>>> (not is_compiled and 'double') or return_type
'double'
...
...
@@ -258,10 +262,6 @@ def cdef_inline(x):
>>> result == 2.0 or result
True
"""
return
x
+
1
def
call_cdef_inline
(
x
):
ret
=
cdef_inline
(
x
)
return
ret
,
cython
.
typeof
(
ret
)
...
...
@@ -304,6 +304,12 @@ def ccall_except(x):
@
cython
.
returns
(
cython
.
long
)
@
cython
.
exceptval
(
-
1
)
def
cdef_except
(
x
):
if
x
==
0
:
raise
ValueError
return
x
+
1
def
call_cdef_except
(
x
):
"""
>>> call_cdef_except(41)
42
...
...
@@ -311,12 +317,6 @@ def cdef_except(x):
Traceback (most recent call last):
ValueError
"""
if
x
==
0
:
raise
ValueError
return
x
+
1
def
call_cdef_except
(
x
):
return
cdef_except
(
x
)
...
...
This diff is collapsed.
Click to expand it.
tests/run/pure_py3.py
View file @
4c3229fe
...
...
@@ -42,6 +42,10 @@ def test_struct(n: cython.int, x: cython.double) -> MyStruct2:
@
cython
.
ccall
def
c_call
(
x
)
->
cython
.
double
:
return
x
def
call_ccall
(
x
):
"""
Test that a declared return type is honoured when compiled.
...
...
@@ -57,10 +61,6 @@ def c_call(x) -> cython.double:
>>> (is_compiled and 1) or result
1
"""
return
x
def
call_ccall
(
x
):
ret
=
c_call
(
x
)
return
ret
,
cython
.
typeof
(
ret
)
...
...
@@ -68,9 +68,13 @@ def call_ccall(x):
@
cython
.
cfunc
@
cython
.
inline
def
cdef_inline
(
x
)
->
cython
.
double
:
return
x
+
1
def
call_cdef_inline
(
x
):
"""
>>> result, return_type = call_cdef_inline(1)
>>> (not is_compiled and 'float') or type(re
turn_type
).__name__
>>> (not is_compiled and 'float') or type(re
sult
).__name__
'float'
>>> (not is_compiled and 'double') or return_type
'double'
...
...
@@ -79,9 +83,5 @@ def cdef_inline(x) -> cython.double:
>>> result == 2.0 or result
True
"""
return
x
+
1
def
call_cdef_inline
(
x
):
ret
=
cdef_inline
(
x
)
return
ret
,
cython
.
typeof
(
ret
)
This diff is collapsed.
Click to expand it.
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