stress_recurse.py 452 B

12345678910111213141516171819202122232425
  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. import _thread
  5. def foo():
  6. foo()
  7. def thread_entry():
  8. try:
  9. foo()
  10. except RuntimeError:
  11. print('RuntimeError')
  12. global finished
  13. finished = True
  14. finished = False
  15. _thread.start_new_thread(thread_entry, ())
  16. # busy wait for thread to finish
  17. while not finished:
  18. pass
  19. print('done')