Skip to content

Commit

Permalink
Add array cimport test.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertwb committed Oct 30, 2012
1 parent 5941a5b commit 3b21621
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/run/array_cimport.srctree
@@ -0,0 +1,37 @@
PYTHON setup.py build_ext --inplace
PYTHON -c "import ttt"

######## setup.py ########

from Cython.Build.Dependencies import cythonize
from distutils.core import setup

setup(
ext_modules = cythonize("*.pyx"),
)


######## tt.pxd ########

from cpython.array cimport array

cdef class Foo:
cdef array obj

######## tt.pyx ########

cdef class Foo:
def __init__(self, data):
self.obj = data

######## ttt.pyx ########

from array import array
from cpython.array cimport array
from tt cimport Foo

cdef array a = array('i', [1,2,3])
cdef Foo x
print a.data.as_ints[0]
x = Foo(a)
print x.obj.data.as_ints[0]

0 comments on commit 3b21621

Please sign in to comment.