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
2a6aa2ef
Commit
2a6aa2ef
authored
May 31, 2020
by
da-woods
Committed by
Stefan Behnel
Jun 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a bug where fused_to_specific was applied too widely
Fixes
https://github.com/cython/cython/issues/3642
parent
22f62fe1
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 @
2a6aa2ef
...
...
@@ -1023,8 +1023,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 @
2a6aa2ef
...
...
@@ -400,3 +400,26 @@ def test_composite(fused_composite x):
return
x
else
:
return
2
*
x
### see GH3642 - presence of cdef inside "unrelated" caused a type to be incorrectly inferred
cdef
unrelated
(
cython
.
floating
x
):
cdef
cython
.
floating
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