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
e2937fcb
Commit
e2937fcb
authored
Feb 10, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More safe types to infer.
parent
736b910d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-0
Cython/Compiler/TypeInference.py
Cython/Compiler/TypeInference.py
+14
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
e2937fcb
...
...
@@ -2492,6 +2492,8 @@ class SimpleCallNode(CallNode):
def
infer_type
(
self
,
env
):
function
=
self
.
function
func_type
=
function
.
infer_type
(
env
)
if
isinstance
(
self
.
function
,
NewExprNode
):
return
PyrexTypes
.
CPtrType
(
self
.
function
.
class_type
)
if
func_type
.
is_ptr
:
func_type
=
func_type
.
base_type
if
func_type
.
is_cfunction
:
...
...
Cython/Compiler/TypeInference.py
View file @
e2937fcb
...
...
@@ -235,6 +235,20 @@ def safe_spanning_type(types):
# find_spanning_type() only returns 'bint' for clean boolean
# operations without other int types, so this is safe, too
return
result_type
elif
result_type
.
is_ptr
and
not
(
result_type
.
is_int
and
result_type
.
rank
==
0
):
# Any pointer except (signed|unsigned|) char* can't implicitly
# become a PyObject.
return
result_type
elif
result_type
.
is_cpp_class
:
# These can't implicitly become Python objects either.
return
result_type
elif
result_type
.
is_struct
:
# Though we have struct -> object for some structs, this is uncommonly
# used, won't arise in pure Python, and there shouldn't be side
# effects, so I'm declaring this safe.
return
result_type
# TODO: double complex should be OK as well, but we need
# to make sure everything is supported.
return
py_object_type
...
...
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