if self.type.from_py_function:
self.operand = self.operand.coerce_to(self.type, env)
elif self.type.is_ptr and not (self.type.base_type.is_void or self.type.base_type.is_struct):
- error(self.pos, "Python objects can only be cast to void*")
+ error(self.pos, "Python objects cannot be casted to pointers of primitive types")
else:
warning(self.pos, "No conversion from %s to %s, python object pointer used." % (self.type, self.operand.type))
elif from_py and to_py:
cdef object blarg
def foo(obj):
- cdef int *p
- p = <int *>blarg # okay
- p = <int *>(foo + blarg) # error - temporary
+ cdef void *p
+ p = <void *>blarg # ok
+ p = <void *>(obj + blarg) # error - temporary
+
_ERRORS = u"""
6:5: Casting temporary Python object to non-numeric non-Python type
"""