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
Kirill Smelkov
cython
Commits
389ba104
Commit
389ba104
authored
Jun 04, 2020
by
scoder
Committed by
GitHub
Jun 04, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Fix a bug where "fused_to_specific" was applied too widely (GH-3654)
Fixes
https://github.com/cython/cython/issues/3642
parents
12c7237b
f808448f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+0
-2
tests/run/fused_types.pyx
tests/run/fused_types.pyx
+23
-0
No files found.
Cython/Compiler/Nodes.py
View file @
389ba104
...
...
@@ -1032,8 +1032,6 @@ class CSimpleBaseTypeNode(CBaseTypeNode):
if
scope
is
None
:
# Maybe it's a cimport.
scope
=
env
.
find_imported_module
(
self
.
module_path
,
self
.
pos
)
if
scope
:
scope
.
fused_to_specific
=
env
.
fused_to_specific
else
:
scope
=
env
...
...
tests/run/fused_types.pyx
View file @
389ba104
...
...
@@ -484,3 +484,26 @@ def test_fused_in_check():
print
(
in_check_2
(
1.0
,
2.0
))
print
(
in_check_2
[
float
,
double
](
1.0
,
2.0
))
print
(
in_check_3
[
float
](
1.0
))
### see GH3642 - presence of cdef inside "unrelated" caused a type to be incorrectly inferred
cdef
unrelated
(
cython
.
floating
x
):
cdef
cython
.
floating
t
=
1
return
t
cdef
handle_float
(
float
*
x
):
return
'float'
cdef
handle_double
(
double
*
x
):
return
'double'
def
convert_to_ptr
(
cython
.
floating
x
):
"""
>>> convert_to_ptr(1.0)
'double'
>>> convert_to_ptr['double'](1.0)
'double'
>>> convert_to_ptr['float'](1.0)
'float'
"""
if
cython
.
floating
is
float
:
return
handle_float
(
&
x
)
elif
cython
.
floating
is
double
:
return
handle_double
(
&
x
)
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