1# ticket: 650 2 3cimport cython 4 5 6@cython.test_assert_path_exists( 7 '//RaiseStatNode', 8 '//RaiseStatNode[@builtin_exc_name = "MemoryError"]') 9def raise_me_type(): 10 """ 11 >>> try: raise_me_type() 12 ... except MemoryError: pass 13 ... else: print('NOT RAISED!') 14 """ 15 raise MemoryError 16 17 18@cython.test_assert_path_exists( 19 '//RaiseStatNode', 20 '//RaiseStatNode[@builtin_exc_name = "MemoryError"]') 21def raise_me_instance(): 22 """ 23 >>> try: raise_me_instance() 24 ... except MemoryError: pass 25 ... else: print('NOT RAISED!') 26 """ 27 raise MemoryError() 28 29 30def raise_me_instance_value(): 31 """ 32 >>> raise_me_instance_value() 33 Traceback (most recent call last): 34 ... 35 MemoryError: oom 36 """ 37 raise MemoryError("oom") 38 39 40def raise_me_instance_value_separate(): 41 """ 42 >>> raise_me_instance_value_separate() 43 Traceback (most recent call last): 44 ... 45 MemoryError: oom 46 """ 47 raise MemoryError, "oom" 48