mirror of
https://github.com/python/cpython.git
synced 2024-11-27 20:04:41 +08:00
bpo-46787: Fix ProcessPoolExecutor exception
memory leak (GH-31408) (#31408)
Do not store `ProcessPoolExecutor` work item exception traceback that prevents exception frame locals from being garbage collected.
This commit is contained in:
parent
c96da83a8e
commit
9c204b148f
@ -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)
|
||||
|
@ -0,0 +1 @@
|
||||
Fix :class:`concurrent.futures.ProcessPoolExecutor` exception memory leak
|
Loading…
Reference in New Issue
Block a user