summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/socket.py2
-rw-r--r--Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst2
2 files changed, 4 insertions, 0 deletions
diff --git a/Lib/socket.py b/Lib/socket.py
index 740e717..1ada24d 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -711,6 +711,8 @@ def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT,
if source_address:
sock.bind(source_address)
sock.connect(sa)
+ # Break explicitly a reference cycle
+ err = None
return sock
except error as _:
diff --git a/Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst b/Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst
new file mode 100644
index 0000000..e522e8e
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst
@@ -0,0 +1,2 @@
+socket.create_connection() now fixes manually a reference cycle: clear the
+variable storing the last exception on success.