1__doc__ = """
2    >>> s = Spam()
3    >>> s.get_tons()
4    17
5    >>> s.set_tons(42)
6    >>> s.get_tons()
7    42
8"""
9
10import platform
11if not hasattr(platform, 'python_implementation') or platform.python_implementation() == 'CPython':
12    __doc__ += """
13    >>> s = None
14    42 tons of spam is history.
15"""
16
17cdef class Spam:
18
19    cdef int tons
20
21    def __cinit__(self):
22        self.tons = 17
23
24    def __dealloc__(self):
25        print self.tons, u"tons of spam is history."
26
27    def get_tons(self):
28        return self.tons
29
30    def set_tons(self, x):
31        self.tons = x
32