summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/concurrent/futures/process.py3
-rw-r--r--Misc/NEWS.d/next/Library/2022-02-18-20-09-29.bpo-46787.juwWc0.rst1
2 files changed, 4 insertions, 0 deletions
diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py
index 695f773..0d49379c 100644
--- a/Lib/concurrent/futures/process.py
+++ b/Lib/concurrent/futures/process.py
@@ -125,6 +125,9 @@ class _ExceptionWithTraceback:
def __init__(self, exc, tb):
tb = ''.join(format_exception(type(exc), exc, tb))
self.exc = exc
+ # Traceback object needs to be garbage-collected as its frames
+ # contain references to all the objects in the exception scope
+ self.exc.__traceback__ = None
self.tb = '\n"""\n%s"""' % tb
def __reduce__(self):
return _rebuild_exc, (self.exc, self.tb)
diff --git a/Misc/NEWS.d/next/Library/2022-02-18-20-09-29.bpo-46787.juwWc0.rst b/Misc/NEWS.d/next/Library/2022-02-18-20-09-29.bpo-46787.juwWc0.rst
new file mode 100644
index 0000000..cf167ff
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2022-02-18-20-09-29.bpo-46787.juwWc0.rst
@@ -0,0 +1 @@
+Fix :class:`concurrent.futures.ProcessPoolExecutor` exception memory leak