Dallas Marlow <dallasmar...@gmail.com> added the comment:
I apologize for all the messages, but the more I look into this issue the stranger it seems. The following code does the following: - print the time - execute 3 futures (2 w/ 30s sleeps) - call as_completed - catch the timeout exception - print the time again - then raise the timeout exception, but only after all futures complete. the second time print executes after the as_completed timeout duration, but the exception was only raised after all futures completed. the exception message incorrectly states that it left 2/3 futures unfinished. ######################### import concurrent.futures import time with concurrent.futures.ThreadPoolExecutor() as ex: print(time.time()) futures = [ ex.submit(time.sleep, 30), ex.submit(time.sleep, 30), ex.submit(print, 'test'), ] try: for future in concurrent.futures.as_completed( futures, timeout=1): _ = future.result() except Exception as e: print(time.time()) raise e ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41694> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com