Cython has moved to github.
cython-devel
view tests/run/boolop.pyx @ 1622:4f0327bdebc9
test for temp allocation bug in call
| author | Robert Bradshaw <robertwb@math.washington.edu> |
|---|---|
| date | Sat Jan 17 01:25:34 2009 -0800 (3 years ago) |
| parents | ff6249a604c2 |
| children | e768f4599b24 |
line source
1 __doc__ = u"""
2 >>> foo(True, False, 23, 'test', 1)
3 (0, 1, False, False)
4 """
6 def foo(obj1, obj2, obj3, obj4, obj5):
7 cdef int bool1, bool2, bool3, bool4
8 cdef char *ptr
9 cdef float f
10 bool1 = 1
11 bool2 = 0
12 ptr = NULL
13 f = 0.0
15 bool3 = bool1 and bool2
16 bool3 = bool1 or bool2
17 bool3 = obj1 and obj2
18 bool3 = bool1 and ptr
19 bool3 = bool1 and f
20 bool4 = bool1 and bool2 and bool3
21 bool4 = bool1 or bool2 and bool3
22 obj4 = obj1 and obj2 and obj3
23 obj5 = (obj1 + obj2 + obj3) and obj4
24 return bool3, bool4, obj4, obj5
