Cython has moved to github.

cython-devel

view tests/run/typedfieldbug_T303.pyx @ 2054:ddaf43291b55

Fixing up flawed fix for #303
author Dag Sverre Seljebotn <dagss@student.matnat.uio.no>
date Thu May 14 17:28:50 2009 +0200 (3 years ago)
parents d29e004c3787
children 3d5aec888da5
line source
1 """
2 >>> f()
3 42.0 42.0 42.0
4 >>> readonly()
5 Traceback (most recent call last):
6 ...
7 AttributeError: attribute 'var_nf' of 'typedfieldbug_T303.MyClass' objects is not writable
8 """
10 cdef extern from "external_defs.h":
11 ctypedef float DoubleTypedef
13 cdef class MyClass:
14 cdef readonly:
15 double var_d
16 DoubleTypedef var_nf
17 cdef public:
18 DoubleTypedef mutable
19 def __init__(self):
20 self.var_d = 42.0
21 self.var_nf = 42.0
22 self.mutable = 1
24 def f():
25 c = MyClass()
26 c.mutable = 42.0
27 print c.var_d, c.var_nf, c.mutable
29 def readonly():
30 c = MyClass()
31 c.var_nf = 3