From: Dag Sverre Seljebotn Date: Thu, 14 May 2009 16:02:32 +0000 (+0200) Subject: Testcase fix, update error message X-Git-Tag: 0.11.2.rc1~10^2~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6b043aa3d70c4c2e2aa144ad328907f542cdfb5d;p=cython.git Testcase fix, update error message --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index b0c7e7ac..f6e2b784 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -3939,7 +3939,7 @@ class TypecastNode(NewTempExprNode): 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: diff --git a/tests/errors/e_tempcast.pyx b/tests/errors/e_tempcast.pyx index 7d80a121..4e59a41c 100644 --- a/tests/errors/e_tempcast.pyx +++ b/tests/errors/e_tempcast.pyx @@ -1,9 +1,10 @@ cdef object blarg def foo(obj): - cdef int *p - p = blarg # okay - p = (foo + blarg) # error - temporary + cdef void *p + p = blarg # ok + p = (obj + blarg) # error - temporary + _ERRORS = u""" 6:5: Casting temporary Python object to non-numeric non-Python type """ diff --git a/tests/errors/pyobjcastdisallow_T313.pyx b/tests/errors/pyobjcastdisallow_T313.pyx index 3d8ea1ce..18ca2b04 100644 --- a/tests/errors/pyobjcastdisallow_T313.pyx +++ b/tests/errors/pyobjcastdisallow_T313.pyx @@ -5,5 +5,5 @@ cdef void* allowed = a cdef double* disallowed = a _ERRORS = u""" -5:26: Python objects can only be cast to void* +5:26: Python objects cannot be casted to pointers of primitive types """