2016-04-20 15:23:55 +01:00
|
|
|
# test hitting the function recursion limit within a thread
|
|
|
|
#
|
|
|
|
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
|
|
|
|
|
|
|
|
import _thread
|
|
|
|
|
|
|
|
def foo():
|
|
|
|
foo()
|
|
|
|
|
|
|
|
def thread_entry():
|
|
|
|
try:
|
|
|
|
foo()
|
|
|
|
except RuntimeError:
|
|
|
|
print('RuntimeError')
|
2016-04-21 13:38:22 +01:00
|
|
|
global finished
|
|
|
|
finished = True
|
|
|
|
|
|
|
|
finished = False
|
2016-04-20 15:23:55 +01:00
|
|
|
|
|
|
|
_thread.start_new_thread(thread_entry, ())
|
|
|
|
|
2016-04-21 13:38:22 +01:00
|
|
|
# busy wait for thread to finish
|
|
|
|
while not finished:
|
|
|
|
pass
|
2016-04-20 15:23:55 +01:00
|
|
|
print('done')
|