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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
f42559d8
Commit
f42559d8
authored
Jul 02, 2011
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Comments, test.
parent
fca87390
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
1 deletion
+55
-1
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+2
-0
Cython/Compiler/Options.py
Cython/Compiler/Options.py
+1
-1
tests/run/cimport_from_pyx.srctree
tests/run/cimport_from_pyx.srctree
+52
-0
No files found.
Cython/Compiler/Main.py
View file @
f42559d8
...
@@ -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
():
...
...
Cython/Compiler/Options.py
View file @
f42559d8
...
@@ -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
=
Tru
e
cimport_from_pyx
=
Fals
e
...
...
tests/run/cimport_from_pyx.srctree
0 → 100644
View file @
f42559d8
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
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