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/filecmp.py | |
parent | c6b20be85c0de6f2355c67ae6e7e578941275cc0 (diff) | |
download | cpython-293dd23477eef6e7c1b1e26b5bb2c1e0d79ac3c2.tar.gz cpython-293dd23477eef6e7c1b1e26b5bb2c1e0d79ac3c2.zip |
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/filecmp.py')
-rw-r--r-- | Lib/filecmp.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/filecmp.py b/Lib/filecmp.py index e5ad8397e4c..cfdca1e924f 100644 --- a/Lib/filecmp.py +++ b/Lib/filecmp.py @@ -156,12 +156,12 @@ class dircmp: ok = 1 try: a_stat = os.stat(a_path) - except OSError as why: + except OSError: # print('Can\'t stat', a_path, ':', why.args[1]) ok = 0 try: b_stat = os.stat(b_path) - except OSError as why: + except OSError: # print('Can\'t stat', b_path, ':', why.args[1]) ok = 0 |