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
Gwenaël Samain
cython
Commits
b3ee6b3c
Commit
b3ee6b3c
authored
Oct 07, 2014
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor type inference simplification.
parent
95228cfe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
11 deletions
+5
-11
Cython/Compiler/TypeInference.py
Cython/Compiler/TypeInference.py
+5
-11
No files found.
Cython/Compiler/TypeInference.py
View file @
b3ee6b3c
...
@@ -494,8 +494,7 @@ def find_spanning_type(type1, type2):
...
@@ -494,8 +494,7 @@ def find_spanning_type(type1, type2):
return
PyrexTypes
.
c_double_type
return
PyrexTypes
.
c_double_type
return
result_type
return
result_type
def
aggressive_spanning_type
(
types
,
might_overflow
,
pos
):
def
simply_type
(
result_type
):
result_type
=
reduce
(
find_spanning_type
,
types
)
if
result_type
.
is_reference
:
if
result_type
.
is_reference
:
result_type
=
result_type
.
ref_base_type
result_type
=
result_type
.
ref_base_type
if
result_type
.
is_const
:
if
result_type
.
is_const
:
...
@@ -506,16 +505,11 @@ def aggressive_spanning_type(types, might_overflow, pos):
...
@@ -506,16 +505,11 @@ def aggressive_spanning_type(types, might_overflow, pos):
result_type
=
PyrexTypes
.
c_ptr_type
(
result_type
.
base_type
)
result_type
=
PyrexTypes
.
c_ptr_type
(
result_type
.
base_type
)
return
result_type
return
result_type
def
aggressive_spanning_type
(
types
,
might_overflow
,
pos
):
return
simply_type
(
reduce
(
find_spanning_type
,
types
))
def
safe_spanning_type
(
types
,
might_overflow
,
pos
):
def
safe_spanning_type
(
types
,
might_overflow
,
pos
):
result_type
=
reduce
(
find_spanning_type
,
types
)
result_type
=
simply_type
(
reduce
(
find_spanning_type
,
types
))
if
result_type
.
is_const
:
result_type
=
result_type
.
const_base_type
if
result_type
.
is_reference
:
result_type
=
result_type
.
ref_base_type
if
result_type
.
is_cpp_class
:
result_type
.
check_nullary_constructor
(
pos
)
if
result_type
.
is_array
:
result_type
=
PyrexTypes
.
c_ptr_type
(
result_type
.
base_type
)
if
result_type
.
is_pyobject
:
if
result_type
.
is_pyobject
:
# In theory, any specific Python type is always safe to
# In theory, any specific Python type is always safe to
# infer. However, inferring str can cause some existing code
# infer. However, inferring str can cause some existing code
...
...
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