Commit e2e70027 authored by Stefan Behnel's avatar Stefan Behnel

avoid some more accidental type coercion helper code generation

parent 184f7edc
...@@ -1251,6 +1251,9 @@ class CConstType(BaseType): ...@@ -1251,6 +1251,9 @@ class CConstType(BaseType):
def deduce_template_params(self, actual): def deduce_template_params(self, actual):
return self.const_base_type.deduce_template_params(actual) return self.const_base_type.deduce_template_params(actual)
def can_coerce_to_pyobject(self, env):
return self.const_base_type.can_coerce_to_pyobject(env)
def create_to_py_utility_code(self, env): def create_to_py_utility_code(self, env):
if self.const_base_type.create_to_py_utility_code(env): if self.const_base_type.create_to_py_utility_code(env):
self.to_py_function = self.const_base_type.to_py_function self.to_py_function = self.const_base_type.to_py_function
...@@ -1420,6 +1423,9 @@ class CIntType(CNumericType): ...@@ -1420,6 +1423,9 @@ class CIntType(CNumericType):
from_py_function = None from_py_function = None
exception_value = -1 exception_value = -1
def can_coerce_to_pyobject(self, env):
return True
def create_to_py_utility_code(self, env): def create_to_py_utility_code(self, env):
if type(self).to_py_function is None: if type(self).to_py_function is None:
self.to_py_function = "__Pyx_PyInt_From_" + self.specialization_name() self.to_py_function = "__Pyx_PyInt_From_" + self.specialization_name()
...@@ -1765,6 +1771,9 @@ class CComplexType(CNumericType): ...@@ -1765,6 +1771,9 @@ class CComplexType(CNumericType):
is_float = self.real_type.is_float)) is_float = self.real_type.is_float))
return True return True
def can_coerce_to_pyobject(self, env):
return True
def create_to_py_utility_code(self, env): def create_to_py_utility_code(self, env):
env.use_utility_code(complex_real_imag_utility_code) env.use_utility_code(complex_real_imag_utility_code)
env.use_utility_code(complex_to_py_utility_code) env.use_utility_code(complex_to_py_utility_code)
...@@ -2397,8 +2406,7 @@ class CFuncType(CType): ...@@ -2397,8 +2406,7 @@ class CFuncType(CType):
# is exempt from compatibility checking (the proper check # is exempt from compatibility checking (the proper check
# is performed elsewhere). # is performed elsewhere).
for i in range(as_cmethod, nargs): for i in range(as_cmethod, nargs):
if not self.args[i].type.same_as( if not self.args[i].type.same_as(other_type.args[i].type):
other_type.args[i].type):
return 0 return 0
if self.has_varargs != other_type.has_varargs: if self.has_varargs != other_type.has_varargs:
return 0 return 0
......
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