Cython has moved to github.

cython-devel

view tests/run/funcexcept.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
children
line source
1 __doc__ = u"""
2 >>> import sys
3 >>> if not IS_PY3: sys.exc_clear()
5 >>> def test_py():
6 ... try:
7 ... raise AttributeError
8 ... except AttributeError:
9 ... print(sys.exc_info()[0] == AttributeError or sys.exc_info()[0])
10 ... print((IS_PY3 and sys.exc_info()[0] is None) or
11 ... (not IS_PY3 and sys.exc_info()[0] == AttributeError) or
12 ... sys.exc_info()[0])
14 >>> print(sys.exc_info()[0]) # 0
15 None
16 >>> test_py()
17 True
18 True
20 >>> print(sys.exc_info()[0]) # test_py()
21 None
23 >>> test_c()
24 True
25 True
26 >>> print(sys.exc_info()[0]) # test_c()
27 None
28 """
30 import sys
32 IS_PY3 = sys.version_info[0] >= 3
34 def test_c():
35 try:
36 raise AttributeError
37 except AttributeError:
38 print(sys.exc_info()[0] == AttributeError or sys.exc_info()[0])
39 print(sys.exc_info()[0] is None or sys.exc_info()[0])