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
cf03fa62
Commit
cf03fa62
authored
Jan 22, 2020
by
isotherm
Committed by
Stefan Behnel
Feb 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FIX: Declare cimported ctuples (GH-1427) (GH-3271)
Closes #1427
parent
e3f413bf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
6 deletions
+32
-6
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+8
-6
tests/compile/ctuple_cimport.pxd
tests/compile/ctuple_cimport.pxd
+15
-0
tests/compile/ctuple_cimport_T1427.pyx
tests/compile/ctuple_cimport_T1427.pyx
+9
-0
No files found.
Cython/Compiler/ModuleNode.py
View file @
cf03fa62
...
...
@@ -575,14 +575,16 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
for
entry
in
vtabslot_list
:
self
.
generate_objstruct_predeclaration
(
entry
.
type
,
code
)
vtabslot_entries
=
set
(
vtabslot_list
)
ctuple_names
=
set
()
for
module
in
modules
:
definition
=
module
is
env
if
definition
:
type_entries
=
module
.
type_entries
else
:
type_entries
=
[]
for
entry
in
module
.
type_entries
:
if
entry
.
defined_in_pxd
:
if
entry
.
type
.
is_ctuple
:
if
entry
.
name
not
in
ctuple_names
:
ctuple_names
.
add
(
entry
.
name
)
type_entries
.
append
(
entry
)
elif
definition
or
entry
.
defined_in_pxd
:
type_entries
.
append
(
entry
)
type_entries
=
[
t
for
t
in
type_entries
if
t
not
in
vtabslot_entries
]
self
.
generate_type_header_code
(
type_entries
,
code
)
...
...
tests/compile/ctuple_cimport.pxd
0 → 100644
View file @
cf03fa62
# Verify defined before function prototype
cdef
(
int
,
int
)
get_a_ctuple
()
# Verify defined before typedef
ctypedef
(
int
,
double
)
int_double
# Verify typedef defined
cdef
int_double
tuple_global
=
(
1
,
2.
)
# Verify defined before opt args
cdef
void
test_opt_args
((
double
,
int
)
x
=*
)
# Verify defined before class declaration
cdef
class
CTupleClass
:
cdef
void
get_a_ctuple
(
self
,
(
double
,
double
)
x
)
tests/compile/ctuple_cimport_T1427.pyx
0 → 100644
View file @
cf03fa62
# ticket: 1427
# mode: compile
cimport
ctuple_cimport
# Verify same tuple defined in multiple pxd not redeclared
ctypedef
(
int
,
double
)
int_double
ctuple_cimport
.
get_a_ctuple
()
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