summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/managers.py
diff options
context:
space:
mode:
authorAndrew Geng <pteromys@gmail.com>2023-08-11 17:44:18 (GMT)
committerGitHub <noreply@github.com>2023-08-11 17:44:18 (GMT)
commit5f7d4ecf301ef12eb1d1d347add054f4fcd8fc5c (patch)
tree33c687f8dfb36db77ce66c08e72bca5025941c61 /Lib/multiprocessing/managers.py
parentcaa41a4f1db0112690cf610bab7d9c6dce9ff1ce (diff)
downloadcpython-5f7d4ecf301ef12eb1d1d347add054f4fcd8fc5c.zip
cpython-5f7d4ecf301ef12eb1d1d347add054f4fcd8fc5c.tar.gz
cpython-5f7d4ecf301ef12eb1d1d347add054f4fcd8fc5c.tar.bz2
gh-106558: break ref cycles through exceptions in multiprocessing manager (#106559)
Diffstat (limited to 'Lib/multiprocessing/managers.py')
-rw-r--r--Lib/multiprocessing/managers.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/multiprocessing/managers.py b/Lib/multiprocessing/managers.py
index b653493..273c22a 100644
--- a/Lib/multiprocessing/managers.py
+++ b/Lib/multiprocessing/managers.py
@@ -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):
'''