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
diff --git a/Lib/poplib.py b/Lib/poplib.py
index e3bd2ab..0b6750d 100644
--- a/Lib/poplib.py
+++ b/Lib/poplib.py
@@ -385,7 +385,7 @@
for capline in rawcaps:
capnm, capargs = _parsecap(capline)
caps[capnm] = capargs
- except error_proto as _err:
+ except error_proto:
raise error_proto('-ERR CAPA not supported by server')
return caps