summaryrefslogtreecommitdiffstats
path: root/Lib/concurrent
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-09-01 12:46:44 (GMT)
committerGitHub <noreply@github.com>2017-09-01 12:46:44 (GMT)
commit60f3f1fb5cbf5354c3081138be806c56cb04153f (patch)
tree9c2a2dd924700930d3a757c32809a768af0a5caa /Lib/concurrent
parentb5db7bb9da1120912a1795fbc6106d0eba5a01c7 (diff)
downloadcpython-60f3f1fb5cbf5354c3081138be806c56cb04153f.zip
cpython-60f3f1fb5cbf5354c3081138be806c56cb04153f.tar.gz
cpython-60f3f1fb5cbf5354c3081138be806c56cb04153f.tar.bz2
bpo-31249: Fix ref cycle in ThreadPoolExecutor (#3253)
[3.6] bpo-31249: Fix ref cycle in ThreadPoolExecutor
Diffstat (limited to 'Lib/concurrent')
-rw-r--r--Lib/concurrent/futures/thread.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/concurrent/futures/thread.py b/Lib/concurrent/futures/thread.py
index 03d276b..5ade790 100644
--- a/Lib/concurrent/futures/thread.py
+++ b/Lib/concurrent/futures/thread.py
@@ -53,8 +53,10 @@ class _WorkItem(object):
try:
result = self.fn(*self.args, **self.kwargs)
- except BaseException as e:
- self.future.set_exception(e)
+ except BaseException as exc:
+ self.future.set_exception(exc)
+ # Break a reference cycle with the exception 'exc'
+ self = None
else:
self.future.set_result(result)