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
7773dd51
Commit
7773dd51
authored
Oct 16, 2019
by
alex-xnor
Committed by
Stefan Behnel
Oct 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure not to emit duplicate typedefs for fused nodes (GH-3112)
parent
70dd7561
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
6 deletions
+47
-6
Cython/Compiler/FusedNode.py
Cython/Compiler/FusedNode.py
+8
-6
tests/compile/fused_redeclare_T3111.pyx
tests/compile/fused_redeclare_T3111.pyx
+39
-0
No files found.
Cython/Compiler/FusedNode.py
View file @
7773dd51
...
...
@@ -507,20 +507,22 @@ class FusedCFuncDefNode(StatListNode):
ndarray = __Pyx_ImportNumPyArrayTypeIfAvailable()
"""
)
seen_typedefs
=
set
()
seen_int_dtypes
=
set
()
for
buffer_type
in
all_buffer_types
:
dtype
=
buffer_type
.
dtype
dtype_name
=
self
.
_dtype_name
(
dtype
)
if
dtype
.
is_typedef
:
#decl_code.putln("ctypedef %s %s" % (dtype.resolve(),
# self._dtype_name(dtype))
)
decl_code
.
putln
(
'ctypedef %s %s "%s"'
%
(
dtype
.
resolve
(),
self
.
_dtype_name
(
dtype
)
,
dtype
.
empty_declaration_code
()))
if
dtype_name
not
in
seen_typedefs
:
seen_typedefs
.
add
(
dtype_name
)
decl_code
.
putln
(
'ctypedef %s %s "%s"'
%
(
dtype
.
resolve
(),
dtype_name
,
dtype
.
empty_declaration_code
()))
if
buffer_type
.
dtype
.
is_int
:
if
str
(
dtype
)
not
in
seen_int_dtypes
:
seen_int_dtypes
.
add
(
str
(
dtype
))
pyx_code
.
context
.
update
(
dtype_name
=
self
.
_dtype_name
(
dtype
)
,
pyx_code
.
context
.
update
(
dtype_name
=
dtype_name
,
dtype_type
=
self
.
_dtype_type
(
dtype
))
pyx_code
.
local_variable_declarations
.
put_chunk
(
u"""
...
...
tests/compile/fused_redeclare_T3111.pyx
0 → 100644
View file @
7773dd51
# ticket: 3111
# mode: compile
# tag: warnings
ctypedef
unsigned
char
npy_uint8
ctypedef
unsigned
short
npy_uint16
ctypedef
fused
dtype_t
:
npy_uint8
ctypedef
fused
dtype_t_out
:
npy_uint8
npy_uint16
def
foo
(
dtype_t
[:]
a
,
dtype_t_out
[:,
:]
b
):
pass
# The primary thing we're trying to test here is the _absence_ of the warning
# "__pyxutil:16:4: '___pyx_npy_uint8' redeclared". The remaining warnings are
# unrelated to this test.
_WARNINGS
=
"""
22:10: 'cpdef_method' redeclared
33:10: 'cpdef_cname_method' redeclared
446:72: Argument evaluation order in C function call is undefined and may not be as expected
446:72: Argument evaluation order in C function call is undefined and may not be as expected
749:34: Argument evaluation order in C function call is undefined and may not be as expected
749:34: Argument evaluation order in C function call is undefined and may not be as expected
943:27: Ambiguous exception value, same as default return value: 0
943:27: Ambiguous exception value, same as default return value: 0
974:29: Ambiguous exception value, same as default return value: 0
974:29: Ambiguous exception value, same as default return value: 0
1002:46: Ambiguous exception value, same as default return value: 0
1002:46: Ambiguous exception value, same as default return value: 0
1092:29: Ambiguous exception value, same as default return value: 0
1092:29: Ambiguous exception value, same as default return value: 0
"""
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