From 1b7dd0bab05a0b82a9b35c306edd35617c4aa19b Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Wed, 11 Jun 2008 15:31:13 -0700 Subject: [PATCH] Tests e_powop, e_pyobinstruct, e_tempcast, e_while, nogilcmeth now pass. --- Cython/Compiler/ExprNodes.py | 3 ++- tests/errors/e_pyobinstruct.pyx | 4 +++- tests/errors/e_tempcast.pyx | 4 +++- tests/errors/e_while.pyx | 2 +- tests/errors/nogilcmeth.pxd | 2 ++ tests/errors/nogilcmeth.pyx | 3 ++- 6 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 tests/errors/nogilcmeth.pxd diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index d4f0ff24..976af1ce 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -3153,7 +3153,8 @@ class PowNode(NumBinopNode): return None def c_types_okay(self, type1, type2): - return type1.is_float or type2.is_float + return (type1.is_float or type2.is_float) and \ + NumBinopNode.c_types_okay(self, type1, type2) def type_error(self): if not (self.operand1.type.is_error or self.operand2.type.is_error): diff --git a/tests/errors/e_pyobinstruct.pyx b/tests/errors/e_pyobinstruct.pyx index fd7e9513..f52b7978 100644 --- a/tests/errors/e_pyobinstruct.pyx +++ b/tests/errors/e_pyobinstruct.pyx @@ -1,3 +1,5 @@ +cdef object x + cdef struct spam: object parrot @@ -5,5 +7,5 @@ def f(): cdef spam s s.parrot = x _ERRORS = u""" -/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_pyobinstruct.pyx:2:8: C struct/union member cannot be a Python object +/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_pyobinstruct.pyx:4:8: C struct/union member cannot be a Python object """ diff --git a/tests/errors/e_tempcast.pyx b/tests/errors/e_tempcast.pyx index 5694b675..dd6b2c9c 100644 --- a/tests/errors/e_tempcast.pyx +++ b/tests/errors/e_tempcast.pyx @@ -1,7 +1,9 @@ +cdef object foo, blarg + def foo(obj): cdef int *p p = blarg # okay p = (foo + blarg) # error - temporary _ERRORS = u""" -/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_tempcast.pyx:4:5: Casting temporary Python object to non-Python type +/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_tempcast.pyx:6:5: Casting temporary Python object to non-numeric non-Python type """ diff --git a/tests/errors/e_while.pyx b/tests/errors/e_while.pyx index aafcf9a1..6b4bfa4c 100644 --- a/tests/errors/e_while.pyx +++ b/tests/errors/e_while.pyx @@ -2,7 +2,7 @@ def f(a, b): cdef int i break # error continue # error - _ERRORS = u""" +_ERRORS = u""" /Local/Projects/D/Pyrex/Source/Tests/Errors2/e_while.pyx:3:1: break statement not inside loop /Local/Projects/D/Pyrex/Source/Tests/Errors2/e_while.pyx:4:1: continue statement not inside loop """ diff --git a/tests/errors/nogilcmeth.pxd b/tests/errors/nogilcmeth.pxd new file mode 100644 index 00000000..5d34090c --- /dev/null +++ b/tests/errors/nogilcmeth.pxd @@ -0,0 +1,2 @@ +cdef class C: + cdef void f(self) nogil diff --git a/tests/errors/nogilcmeth.pyx b/tests/errors/nogilcmeth.pyx index 536be3b0..f480da07 100644 --- a/tests/errors/nogilcmeth.pyx +++ b/tests/errors/nogilcmeth.pyx @@ -3,5 +3,6 @@ cdef class C: pass _ERRORS = u""" -2:6: Signature does not match previous declaration +nogilcmeth.pyx:2:9: Signature not compatible with previous declaration +nogilcmeth.pxd:2:15: Previous declaration is here """ -- 2.26.2