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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
4592586d
Commit
4592586d
authored
Oct 02, 2017
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add late import test.
parent
9cdacc94
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
tests/run/extern_include_order.srctree
tests/run/extern_include_order.srctree
+55
-0
No files found.
tests/run/extern_include_order.srctree
0 → 100644
View file @
4592586d
PYTHON setup.py build_ext --inplace
PYTHON -c "import a"
PYTHON -c "import b"
######## setup.py ########
from Cython.Build import cythonize
from distutils.core import setup
setup(
ext_modules = cythonize("*.pyx"),
)
######## a.pxd ########
cdef extern from "a_early.h":
ctypedef int my_int
cdef extern from "a_late.h":
my_int square_value_plus_one()
cdef my_int my_value "my_value"
cdef my_int square "square"(my_int x)
######## a.pyx ########
my_value = 10
cdef my_int square "square"(my_int x):
return x * x
assert square_value_plus_one() == 101
# Square must be explicitly used for its proto to be generated.
cdef my_int use_square(x):
return square(x)
######## a_early.h ########
typedef int my_int;
######## a_late.h ########
static my_int square_value_plus_one() {
return square(my_value) + 1;
}
######## b.pyx ########
cimport a
# Likewise, a.square must be explicitly used.
assert a.square(a.my_value) + 1 == 101
assert a.square_value_plus_one() == 101
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