We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3be6956 commit 0d70be9Copy full SHA for 0d70be9
Lib/concurrent/futures/_base.py
@@ -634,11 +634,10 @@ def result_iterator():
634
# yield the awaited result
635
yield fs.pop()._result
636
finally:
637
- if fs:
638
- # break a reference cycle with fs[-1]._exception
+ while fs:
+ # cancel pending futures, popping them to break potential
639
+ # reference cycles with future._exception.__traceback__
640
fs.pop().cancel()
- for future in fs:
641
- future.cancel()
642
return result_iterator()
643
644
def shutdown(self, wait=True, *, cancel_futures=False):
0 commit comments