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
91eb5180
Commit
91eb5180
authored
May 31, 2020
by
da-woods
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
0532a091
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+0
-2
tests/run/fused_types.pyx
tests/run/fused_types.pyx
+22
-0
No files found.
Cython/Compiler/Nodes.py
View file @
91eb5180
...
...
@@ -1031,8 +1031,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 @
91eb5180
...
...
@@ -484,3 +484,25 @@ 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
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