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
b6f77033
Commit
b6f77033
authored
Oct 13, 2011
by
Mark Florisson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:cython/cython
parents
3b890987
21897347
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
33 deletions
+21
-33
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+21
-21
tests/run/type_inference.pyx
tests/run/type_inference.pyx
+0
-12
No files found.
Cython/Compiler/ExprNodes.py
View file @
b6f77033
...
@@ -3232,27 +3232,6 @@ class CallNode(ExprNode):
...
@@ -3232,27 +3232,6 @@ class CallNode(ExprNode):
# allow overriding the default 'may_be_none' behaviour
# allow overriding the default 'may_be_none' behaviour
may_return_none
=
None
may_return_none
=
None
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
:
return
func_type
.
return_type
elif
func_type
is
type_type
:
if
function
.
is_name
and
function
.
entry
and
function
.
entry
.
type
:
result_type
=
function
.
entry
.
type
if
result_type
.
is_extension_type
:
return
result_type
elif
result_type
.
is_builtin_type
:
if
function
.
entry
.
name
==
'float'
:
return
PyrexTypes
.
c_double_type
elif
function
.
entry
.
name
in
Builtin
.
types_that_construct_their_instance
:
return
result_type
return
py_object_type
def
may_be_none
(
self
):
def
may_be_none
(
self
):
if
self
.
may_return_none
is
not
None
:
if
self
.
may_return_none
is
not
None
:
return
self
.
may_return_none
return
self
.
may_return_none
...
@@ -3330,6 +3309,27 @@ class SimpleCallNode(CallNode):
...
@@ -3330,6 +3309,27 @@ class SimpleCallNode(CallNode):
# the case of function overloading.
# the case of function overloading.
return
self
.
function
.
type_dependencies
(
env
)
return
self
.
function
.
type_dependencies
(
env
)
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
:
return
func_type
.
return_type
elif
func_type
is
type_type
:
if
function
.
is_name
and
function
.
entry
and
function
.
entry
.
type
:
result_type
=
function
.
entry
.
type
if
result_type
.
is_extension_type
:
return
result_type
elif
result_type
.
is_builtin_type
:
if
function
.
entry
.
name
==
'float'
:
return
PyrexTypes
.
c_double_type
elif
function
.
entry
.
name
in
Builtin
.
types_that_construct_their_instance
:
return
result_type
return
py_object_type
def
analyse_as_type
(
self
,
env
):
def
analyse_as_type
(
self
,
env
):
attr
=
self
.
function
.
as_cython_attribute
()
attr
=
self
.
function
.
as_cython_attribute
()
if
attr
==
'pointer'
:
if
attr
==
'pointer'
:
...
...
tests/run/type_inference.pyx
View file @
b6f77033
...
@@ -513,18 +513,6 @@ def common_extension_type_base():
...
@@ -513,18 +513,6 @@ def common_extension_type_base():
w
=
CC
()
w
=
CC
()
assert
typeof
(
w
)
==
"Python object"
,
typeof
(
w
)
assert
typeof
(
w
)
==
"Python object"
,
typeof
(
w
)
cdef
class
AcceptsKeywords
:
def
__init__
(
self
,
*
args
,
**
kwds
):
pass
@
infer_types
(
None
)
def
constructor_call
():
"""
>>> constructor_call()
"""
x
=
AcceptsKeywords
(
a
=
1
,
b
=
2
)
assert
typeof
(
x
)
==
"AcceptsKeywords"
,
typeof
(
x
)
@
infer_types
(
None
)
@
infer_types
(
None
)
def
large_literals
():
def
large_literals
():
...
...
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