Commit b6f77033 authored by Mark Florisson's avatar Mark Florisson

Merge branch 'master' of github.com:cython/cython

parents 3b890987 21897347
...@@ -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':
......
...@@ -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():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment