Cython has moved to github.

cython-devel

view tests/run/cunion.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 585d725fe537
children 82d312a9f1fc
line source
1 __doc__ = u"""
2 >>> test_i()
3 >>> test_c()
4 >>> test_p()
5 """
7 cdef union Spam:
8 int i
9 char c
10 float *p[42]
12 cdef Spam spam, ham
14 cdef void eggs_i(Spam s):
15 cdef int j
16 j = s.i
17 s.i = j
19 cdef void eggs_c(Spam s):
20 cdef char c
21 c = s.c
22 s.c = c
24 cdef void eggs_p(Spam s):
25 cdef float *p
26 p = s.p[0]
27 s.p[0] = p
29 spam = ham
31 def test_i():
32 spam.i = 1
33 eggs_i(spam)
35 def test_c():
36 spam.c = c'a'
37 eggs_c(spam)
39 def test_p():
40 cdef float f
41 spam.p[0] = &f
42 eggs_p(spam)