Cython has moved to github.

cython-devel

view tests/run/append.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 622d0451bb3c
children 82d312a9f1fc
line source
1 __doc__ = u"""
2 >>> test_append([])
3 None
4 None
5 None
6 got error
7 [1, 2, (3, 4)]
8 >>> _ = test_append(A())
9 appending
10 1
11 appending
12 2
13 appending
14 (3, 4)
15 got error
16 >>> test_append(B())
17 None
18 None
19 None
20 None
21 [1, 2, (3, 4), 5, 6]
22 """
24 class A:
25 def append(self, x):
26 print u"appending"
27 return x
29 class B(list):
30 def append(self, *args):
31 for arg in args:
32 list.append(self, arg)
34 def test_append(L):
35 print L.append(1)
36 print L.append(2)
37 print L.append((3,4))
38 try:
39 print L.append(5,6)
40 except TypeError:
41 print u"got error"
42 return L