gh-106558: break ref cycles through exceptions in multiprocessing manager (#106559)

This commit is contained in:
Andrew Geng 2023-08-11 13:44:18 -04:00 committed by GitHub
parent caa41a4f1d
commit 5f7d4ecf30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 2 deletions

View file

@ -90,7 +90,10 @@ def dispatch(c, id, methodname, args=(), kwds={}):
kind, result = c.recv()
if kind == '#RETURN':
return result
raise convert_to_error(kind, result)
try:
raise convert_to_error(kind, result)
finally:
del result # break reference cycle
def convert_to_error(kind, result):
if kind == '#ERROR':
@ -833,7 +836,10 @@ class BaseProxy(object):
conn = self._Client(token.address, authkey=self._authkey)
dispatch(conn, None, 'decref', (token.id,))
return proxy
raise convert_to_error(kind, result)
try:
raise convert_to_error(kind, result)
finally:
del result # break reference cycle
def _getvalue(self):
'''