Commit 405ec484 authored by Dag Sverre Seljebotn's avatar Dag Sverre Seljebotn

Attempt to fix disappearence of conversion errors (introduced by b8850487f853)

parent 4ef4ba83
...@@ -5177,7 +5177,7 @@ class CoerceToPyTypeNode(CoercionNode): ...@@ -5177,7 +5177,7 @@ class CoerceToPyTypeNode(CoercionNode):
self.type = py_object_type self.type = py_object_type
self.gil_check(env) self.gil_check(env)
self.is_temp = 1 self.is_temp = 1
if not arg.type.to_py_function or not arg.type.create_to_py_utility_code(env): if not arg.type.create_to_py_utility_code(env):
error(arg.pos, error(arg.pos,
"Cannot convert '%s' to Python object" % arg.type) "Cannot convert '%s' to Python object" % arg.type)
...@@ -5215,7 +5215,7 @@ class CoerceFromPyTypeNode(CoercionNode): ...@@ -5215,7 +5215,7 @@ class CoerceFromPyTypeNode(CoercionNode):
CoercionNode.__init__(self, arg) CoercionNode.__init__(self, arg)
self.type = result_type self.type = result_type
self.is_temp = 1 self.is_temp = 1
if not result_type.from_py_function and not result_type.create_from_py_utility_code(env): if not result_type.create_from_py_utility_code(env):
error(arg.pos, error(arg.pos,
"Cannot convert Python object to '%s'" % result_type) "Cannot convert Python object to '%s'" % result_type)
if self.type.is_string and self.arg.is_ephemeral(): if self.type.is_string and self.arg.is_ephemeral():
......
...@@ -445,10 +445,10 @@ class CType(PyrexType): ...@@ -445,10 +445,10 @@ class CType(PyrexType):
exception_check = 1 exception_check = 1
def create_to_py_utility_code(self, env): def create_to_py_utility_code(self, env):
return True return self.to_py_function is not None
def create_from_py_utility_code(self, env): def create_from_py_utility_code(self, env):
return True return self.from_py_function is not None
def error_condition(self, result_code): def error_condition(self, result_code):
conds = [] conds = []
......
...@@ -4,7 +4,11 @@ cdef void foo(obj): ...@@ -4,7 +4,11 @@ cdef void foo(obj):
cdef int *p2 cdef int *p2
i1 = p1 # error i1 = p1 # error
p2 = obj # error p2 = obj # error
obj = p2 # error
_ERRORS = u""" _ERRORS = u"""
5:16: Cannot assign type 'char *' to 'int' 5:16: Cannot assign type 'char *' to 'int'
6:17: Cannot convert Python object to 'int *' 6:17: Cannot convert Python object to 'int *'
8:17: Cannot convert 'int *' to Python object
""" """
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