Skip to content

Commit 3be6956

Browse files
committed
break a reference cycle with fs[-1]._exception
1 parent 2a2119e commit 3be6956

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Lib/concurrent/futures/_base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,9 @@ def result_iterator():
634634
# yield the awaited result
635635
yield fs.pop()._result
636636
finally:
637+
if fs:
638+
# break a reference cycle with fs[-1]._exception
639+
fs.pop().cancel()
637640
for future in fs:
638641
future.cancel()
639642
return result_iterator()

0 commit comments

Comments
 (0)