diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2019-11-19 21:34:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-19 21:34:03 (GMT) |
commit | 293dd23477eef6e7c1b1e26b5bb2c1e0d79ac3c2 (patch) | |
tree | 295b4eee204f0d1e4723e62825a86310ddc27578 /Lib/multiprocessing | |
parent | c6b20be85c0de6f2355c67ae6e7e578941275cc0 (diff) | |
download | cpython-293dd23477eef6e7c1b1e26b5bb2c1e0d79ac3c2.zip cpython-293dd23477eef6e7c1b1e26b5bb2c1e0d79ac3c2.tar.gz cpython-293dd23477eef6e7c1b1e26b5bb2c1e0d79ac3c2.tar.bz2 |
Remove binding of captured exceptions when not used to reduce the chances of creating cycles (GH-17246)
Capturing exceptions into names can lead to reference cycles though the __traceback__ attribute of the exceptions in some obscure cases that have been reported previously and fixed individually. As these variables are not used anyway, we can remove the binding to reduce the chances of creating reference cycles.
See for example GH-13135
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r-- | Lib/multiprocessing/managers.py | 4 | ||||
-rw-r--r-- | Lib/multiprocessing/popen_fork.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/Lib/multiprocessing/managers.py b/Lib/multiprocessing/managers.py index 75b5150..1f9c2da 100644 --- a/Lib/multiprocessing/managers.py +++ b/Lib/multiprocessing/managers.py @@ -248,7 +248,7 @@ class Server(object): try: obj, exposed, gettypeid = \ self.id_to_local_proxy_obj[ident] - except KeyError as second_ke: + except KeyError: raise ke if methodname not in exposed: @@ -296,7 +296,7 @@ class Server(object): try: try: send(msg) - except Exception as e: + except Exception: send(('#UNSERIALIZABLE', format_exc())) except Exception as e: util.info('exception in thread serving %r', diff --git a/Lib/multiprocessing/popen_fork.py b/Lib/multiprocessing/popen_fork.py index 11e2160..a65b06f 100644 --- a/Lib/multiprocessing/popen_fork.py +++ b/Lib/multiprocessing/popen_fork.py @@ -25,7 +25,7 @@ class Popen(object): if self.returncode is None: try: pid, sts = os.waitpid(self.pid, flag) - except OSError as e: + except OSError: # Child process not yet created. See #1731717 # e.errno == errno.ECHILD == 10 return None |