aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2019-11-19 21:34:03 +0000
committerGitHub <noreply@github.com>2019-11-19 21:34:03 +0000
commit293dd23477eef6e7c1b1e26b5bb2c1e0d79ac3c2 (patch)
tree295b4eee204f0d1e4723e62825a86310ddc27578 /Lib/enum.py
parentbpo-38707: Fix for multiprocessing.Process MainThread.native_id (GH-17088) (diff)
downloadcpython-293dd23477eef6e7c1b1e26b5bb2c1e0d79ac3c2.tar.gz
cpython-293dd23477eef6e7c1b1e26b5bb2c1e0d79ac3c2.tar.bz2
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/enum.py')
-rw-r--r--Lib/enum.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/enum.py b/Lib/enum.py
index 8a6e5d2e46d..06f42a97803 100644
--- a/Lib/enum.py
+++ b/Lib/enum.py
@@ -420,7 +420,7 @@ class EnumMeta(type):
if module is None:
try:
module = sys._getframe(2).f_globals['__name__']
- except (AttributeError, ValueError, KeyError) as exc:
+ except (AttributeError, ValueError, KeyError):
pass
if module is None:
_make_class_unpicklable(enum_class)