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
Kirill Smelkov
cython
Commits
4be91ce6
Commit
4be91ce6
authored
Oct 03, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.27.x'
parents
7d8e5ed0
15ce8b91
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
4 deletions
+26
-4
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+3
-1
tests/run/pure_pxd.srctree
tests/run/pure_pxd.srctree
+23
-3
No files found.
Cython/Compiler/ExprNodes.py
View file @
4be91ce6
...
@@ -1372,7 +1372,9 @@ def _analyse_name_as_type(name, pos, env):
...
@@ -1372,7 +1372,9 @@ def _analyse_name_as_type(name, pos, env):
else
:
else
:
sizeof_node
=
declaration
.
root
.
stats
[
0
].
expr
sizeof_node
=
declaration
.
root
.
stats
[
0
].
expr
if
isinstance
(
sizeof_node
,
SizeofTypeNode
):
if
isinstance
(
sizeof_node
,
SizeofTypeNode
):
return
sizeof_node
.
arg_type
.
analyse_types
(
env
)
sizeof_node
=
sizeof_node
.
analyse_types
(
env
)
if
isinstance
(
sizeof_node
,
SizeofTypeNode
):
return
sizeof_node
.
arg_type
return
None
return
None
...
...
tests/run/pure_pxd.srctree
View file @
4be91ce6
PYTHON setup.py build_ext --inplace
PYTHON setup.py build_ext --inplace
PYTHON -c "import a; a.test()"
PYTHON -c "import a; a.test(
a
)"
######## setup.py ########
######## setup.py ########
...
@@ -37,6 +37,18 @@ class ExtTypeAttributes(object):
...
@@ -37,6 +37,18 @@ class ExtTypeAttributes(object):
self.b = [1, 2, 3]
self.b = [1, 2, 3]
class TypedMethod():
"""
>>> t = TypedMethod()
>>> t.meth()
0.0
"""
def meth(self):
from array import array
x = array('d', [0.0])
return x[0]
def func(a, b, c):
def func(a, b, c):
"""
"""
>>> func(1, 2, 3)
>>> func(1, 2, 3)
...
@@ -45,7 +57,7 @@ def func(a, b, c):
...
@@ -45,7 +57,7 @@ def func(a, b, c):
return a + b + c
return a + b + c
def test():
def test(
module
):
import os.path
import os.path
assert not os.path.basename(__file__).endswith('.py'), __file__
assert not os.path.basename(__file__).endswith('.py'), __file__
assert not os.path.basename(__file__).endswith('.pyc'), __file__
assert not os.path.basename(__file__).endswith('.pyc'), __file__
...
@@ -57,11 +69,14 @@ def test():
...
@@ -57,11 +69,14 @@ def test():
assert '>>> ' in func.__doc__
assert '>>> ' in func.__doc__
import doctest
import doctest
doctest.testmod(verbose=True)
result = doctest.testmod(module, verbose=True)
assert not result.failed, result.failed
######## a.pxd ########
######## a.pxd ########
cimport cython
cdef class ExtTypePass:
cdef class ExtTypePass:
pass
pass
...
@@ -75,4 +90,9 @@ cdef class ExtTypeAttributes:
...
@@ -75,4 +90,9 @@ cdef class ExtTypeAttributes:
cdef readonly list b
cdef readonly list b
cdef class TypedMethod:
@cython.locals(x='double[:]')
cpdef meth(self)
cpdef int func(x, int y, z) except? -1 # argument names should not matter, types should
cpdef int func(x, int y, z) except? -1 # argument names should not matter, types should
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