1# test hitting the function recursion limit within a thread
2#
3# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
4
5import _thread
6
7
8def foo():
9    foo()
10
11
12def thread_entry():
13    try:
14        foo()
15    except RuntimeError:
16        print("RuntimeError")
17    global finished
18    finished = True
19
20
21finished = False
22
23_thread.start_new_thread(thread_entry, ())
24
25# busy wait for thread to finish
26while not finished:
27    pass
28print("done")
29