mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
bpo-46787: Fix ProcessPoolExecutor exception memory leak (GH-31408) (GH-31408)
Do not store `ProcessPoolExecutor` work item exception traceback that prevents
exception frame locals from being garbage collected.
(cherry picked from commit 9c204b148f)
Co-authored-by: themylogin <themylogin@gmail.com>
This commit is contained in:
parent
3fe4e4602d
commit
51b885a38a
2 changed files with 4 additions and 0 deletions
|
|
@ -126,6 +126,9 @@ def __init__(self, exc, tb):
|
|||
tb = traceback.format_exception(type(exc), exc, tb)
|
||||
tb = ''.join(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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue