Commit 4be91ce6 authored by Stefan Behnel's avatar Stefan Behnel

Merge branch '0.27.x'

parents 7d8e5ed0 15ce8b91
......@@ -1372,7 +1372,9 @@ def _analyse_name_as_type(name, pos, env):
else:
sizeof_node = declaration.root.stats[0].expr
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
......
PYTHON setup.py build_ext --inplace
PYTHON -c "import a; a.test()"
PYTHON -c "import a; a.test(a)"
######## setup.py ########
......@@ -37,6 +37,18 @@ class ExtTypeAttributes(object):
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):
"""
>>> func(1, 2, 3)
......@@ -45,7 +57,7 @@ def func(a, b, c):
return a + b + c
def test():
def test(module):
import os.path
assert not os.path.basename(__file__).endswith('.py'), __file__
assert not os.path.basename(__file__).endswith('.pyc'), __file__
......@@ -57,11 +69,14 @@ def test():
assert '>>> ' in func.__doc__
import doctest
doctest.testmod(verbose=True)
result = doctest.testmod(module, verbose=True)
assert not result.failed, result.failed
######## a.pxd ########
cimport cython
cdef class ExtTypePass:
pass
......@@ -75,4 +90,9 @@ cdef class ExtTypeAttributes:
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
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