# mode: run
+# tag: memoryview
+
cdef double[:] foo(int i):
if i == 1:
if i == 4:
raise TypeError('dummy')
+
def propagate(i):
- '''
+ """
>>> propagate(0)
- TypeError('Memoryview return value is not initialized',)
+ TypeError('Memoryview return value is not initialized')
>>> propagate(1)
- AttributeError('dummy',)
+ AttributeError('dummy')
>>> propagate(2)
- RuntimeError('dummy',)
+ RuntimeError('dummy')
>>> propagate(3)
- ValueError('dummy',)
+ ValueError('dummy')
>>> propagate(4)
- TypeError('dummy',)
- '''
+ TypeError('dummy')
+ """
try:
foo(i)
except Exception as e:
- print repr(e)
+ print '%s(%r)' % (e.__class__.__name__, e.args[0])
else:
- print 'Exception sublass not raised'
+ print 'Exception subclass not raised'