summaryrefslogtreecommitdiff
path: root/tests/errors/return_outside_function_T135.pyx
blob: d7432ca509dcf3da8536684b4a40e8d41d8a3045 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# cython: remove_unreachable=False
# ticket: 135
# mode: error

def _runtime_True():
    return True

return 'bar'

class A:
    return None

cdef class B:
    return None

try: return None
except: pass

try: return None
finally: pass

for i in (1,2):
    return None

while True:
    return None

if _runtime_True():
    return None
else:
    return None


_ERRORS = u'''
8:0: Return not inside a function body
11:4: Return not inside a function body
14:4: Return not inside a function body
16:5: Return not inside a function body
19:5: Return not inside a function body
23:4: Return not inside a function body
26:4: Return not inside a function body
29:4: Return not inside a function body
31:4: Return not inside a function body
'''