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
Gwenaël Samain
cython
Commits
0369269d
Commit
0369269d
authored
Jul 10, 2014
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't generate wrappers for cimported enums.
parent
42ac1407
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
1 deletion
+48
-1
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+3
-1
tests/run/cpdef_enums_import.srctree
tests/run/cpdef_enums_import.srctree
+45
-0
No files found.
Cython/Compiler/ModuleNode.py
View file @
0369269d
...
@@ -2377,7 +2377,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -2377,7 +2377,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
def
generate_wrapped_entries_code
(
self
,
env
,
code
):
def
generate_wrapped_entries_code
(
self
,
env
,
code
):
for
name
,
entry
in
env
.
entries
.
items
():
for
name
,
entry
in
env
.
entries
.
items
():
if
entry
.
create_wrapper
and
not
entry
.
is_type
:
if
(
entry
.
create_wrapper
and
not
entry
.
is_type
and
entry
.
scope
is
env
):
if
not
entry
.
type
.
create_to_py_utility_code
(
env
):
if
not
entry
.
type
.
create_to_py_utility_code
(
env
):
error
(
entry
.
pos
,
"Cannot convert '%s' to Python object"
%
entry
.
type
)
error
(
entry
.
pos
,
"Cannot convert '%s' to Python object"
%
entry
.
type
)
code
.
putln
(
"{"
)
code
.
putln
(
"{"
)
...
...
tests/run/cpdef_enums_import.srctree
0 → 100644
View file @
0369269d
PYTHON setup.py build_ext --inplace
PYTHON -c "import import_enums_test"
######## setup.py ########
from Cython.Build.Dependencies import cythonize
from distutils.core import setup
setup(
ext_modules = cythonize(["enums.pyx", "no_enums.pyx"]),
)
######## enums.pyx ########
cpdef enum:
BAR
cpdef foo(): pass
######## enums.pxd ########
cpdef enum:
FOO
cpdef foo()
######## no_enums.pyx ########
from enums cimport *
######## import_enums_test.py ########
# We can import enums with a star import.
from enums import *
print dir()
assert 'BAR' in dir() and 'FOO' in dir()
# enums not generated in the wrong module
import no_enums
print dir(no_enums)
assert 'FOO' not in dir(no_enums)
assert 'foo' not in dir(no_enums)
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