Commit f42559d8 authored by Robert Bradshaw's avatar Robert Bradshaw

Comments, test.

parent fca87390
...@@ -249,9 +249,11 @@ class Context(object): ...@@ -249,9 +249,11 @@ class Context(object):
FlattenInListTransform, FlattenInListTransform,
WithTransform, WithTransform,
]: ]:
# Skip these unnecessary stages.
continue continue
pipeline.append(stage) pipeline.append(stage)
if isinstance(stage, AnalyseDeclarationsTransform): if isinstance(stage, AnalyseDeclarationsTransform):
# This is the last stage we need.
break break
def fake_pxd(root): def fake_pxd(root):
for entry in root.scope.entries.values(): for entry in root.scope.entries.values():
......
...@@ -64,7 +64,7 @@ disable_function_redefinition = False ...@@ -64,7 +64,7 @@ disable_function_redefinition = False
old_style_globals = False old_style_globals = False
# Allows cimporting from a pyx file without a pxd file. # Allows cimporting from a pyx file without a pxd file.
cimport_from_pyx = True cimport_from_pyx = False
......
PYTHON setup.py build_ext --inplace
PYTHON -c "import a"
######## setup.py ########
from Cython.Build.Dependencies import cythonize
import Cython.Compiler.Options
Cython.Compiler.Options.cimport_from_pyx = True
from distutils.core import setup
setup(
ext_modules = cythonize("*.pyx"),
)
######## a.pyx ########
from b cimport Bclass, Bfunc, Bstruct, Benum, Benum_value, Btypedef
cdef Bclass b = Bclass(5)
assert Bfunc(&b.value) == b.value
assert b.asStruct().value == b.value
cdef Btypedef b_type = &b.value
cdef Benum b_enum = Benum_value
#from c cimport ClassC
#cdef ClassC c = ClassC()
#print c.value
######## b.pyx ########
cdef enum Benum:
Benum_value
cdef struct Bstruct:
int value
ctypedef long *Btypedef
cdef class Bclass:
cdef long value
def __init__(self, value):
self.value = value
cdef Bstruct asStruct(self):
return Bstruct(value=self.value)
cdef long Bfunc(Btypedef x):
return x[0]
######## c.pxd ########
cdef class ClassC:
cdef int value
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