Cython has moved to github.
cython-devel
view tests/run/r_spamtype.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 | 832e5eaeb740 |
| children | 1dadfbd04642 |
line source
1 __doc__ = u"""
2 >>> s = Spam()
3 >>> s.get_tons()
4 17
5 >>> s.set_tons(42)
6 >>> s.get_tons()
7 42
8 >>> s = None
9 42 tons of spam is history.
10 """
12 cdef class Spam:
14 cdef int tons
16 def __cinit__(self):
17 self.tons = 17
19 def __dealloc__(self):
20 print self.tons, u"tons of spam is history."
22 def get_tons(self):
23 return self.tons
25 def set_tons(self, x):
26 self.tons = x
