Cython has moved to github.
cython-devel
view tests/run/extinherit.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 >>> p = create()
3 >>> rest(p)
4 0
5 """
7 cdef class Parrot:
8 cdef object name
9 cdef int alive
11 cdef class Norwegian(Parrot):
12 cdef object plumage_colour
14 def create():
15 cdef Parrot p
16 p = Norwegian()
17 p.alive = 1
18 return p
20 def rest(Norwegian polly):
21 cdef Parrot fred
22 cdef object spam
23 spam = None
25 fred = polly
26 polly = fred
27 polly = spam
28 assert polly is None
29 assert fred.alive
31 spam = polly
32 fred.alive = 0
34 return fred.alive
