Commit 2edd9045 authored by Robert Bradshaw's avatar Robert Bradshaw

C++ cythonize test.

parent bc01fbfd
......@@ -426,7 +426,7 @@ def create_extension_list(patterns, ctx=None, aliases=None):
def cythonize(module_list, nthreads=0, aliases=None, **options):
c_options = CompilationOptions(options)
cpp_options = CompilationOptions(options); cpp_options.cplus = True
ctx = options.create_context()
ctx = c_options.create_context()
module_list = create_extension_list(module_list, ctx=ctx, aliases=aliases)
deps = create_dependency_tree(ctx)
to_compile = []
......
......@@ -564,7 +564,7 @@ def create_default_resultobj(compilation_source, options):
def run_pipeline(source, options, full_module_name = None):
# Set up context
context = optons.create_context()
context = options.create_context()
# Set up source object
cwd = os.getcwd()
......
PYTHON setup.py build_ext --inplace
PYTHON -c "import a; a.use_vector([1,2,3])"
######## setup.py ########
from Cython.Build.Dependencies import cythonize
from distutils.core import setup
setup(
ext_modules = cythonize("*.pyx"),
)
######## a.pyx ########
# distutils: language = c++
from libcpp.vector cimport vector
def use_vector(L):
try:
v = new vector[int]()
for a in L:
v.push_back(a)
return v.size()
finally:
del v
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