Cython has moved to github.
cython-devel
view tests/run/new_style_exceptions.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 | 6309e21af543 |
| children | 82d312a9f1fc |
line source
1 __doc__ = u"""
2 >>> test(Exception(u'hi'))
3 Raising: Exception(u'hi',)
4 Caught: Exception(u'hi',)
5 """
7 import sys
8 if sys.version_info[0] >= 3:
9 __doc__ = __doc__.replace(u"u'", u"'")
11 import sys, types
13 def test(obj):
14 print u"Raising: %s%r" % (obj.__class__.__name__, obj.args)
15 try:
16 raise obj
17 except:
18 info = sys.exc_info()
19 if sys.version_info >= (2,5):
20 assert isinstance(info[0], type)
21 else:
22 assert isinstance(info[0], types.ClassType)
23 print u"Caught: %s%r" % (info[1].__class__.__name__, info[1].args)
