diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2019-11-19 21:34:03 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-19 21:34:03 +0000 |
commit | 293dd23477eef6e7c1b1e26b5bb2c1e0d79ac3c2 (patch) | |
tree | 295b4eee204f0d1e4723e62825a86310ddc27578 /Lib/asyncio/unix_events.py | |
parent | c6b20be85c0de6f2355c67ae6e7e578941275cc0 (diff) | |
download | cpython-git-293dd23477eef6e7c1b1e26b5bb2c1e0d79ac3c2.tar.gz |
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/asyncio/unix_events.py')
-rw-r--r-- | Lib/asyncio/unix_events.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index 66213728a3..632546ad00 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -330,7 +330,7 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop): async def _sock_sendfile_native(self, sock, file, offset, count): try: os.sendfile - except AttributeError as exc: + except AttributeError: raise exceptions.SendfileNotAvailableError( "os.sendfile() is not available") try: @@ -339,7 +339,7 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop): raise exceptions.SendfileNotAvailableError("not a regular file") try: fsize = os.fstat(fileno).st_size - except OSError as err: + except OSError: raise exceptions.SendfileNotAvailableError("not a regular file") blocksize = count if count else fsize if not blocksize: |