[Python-checkins] cpython (merge default -> default): Merge with remote.
ross.lagerwall
python-checkins at python.org
Sat Jul 7 18:44:03 CEST 2012
http://hg.python.org/cpython/rev/00cd92d0b7d4
changeset: 77979:00cd92d0b7d4
parent: 77977:b51a85ed3e63
parent: 77978:c9299edf1f67
user: Ross Lagerwall <rosslagerwall at gmail.com>
date: Sat Jul 07 18:42:57 2012 +0200
summary:
Merge with remote.
files:
Lib/test/support.py | 8 +++++---
Misc/NEWS | 6 ++++++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/Lib/test/support.py b/Lib/test/support.py
--- a/Lib/test/support.py
+++ b/Lib/test/support.py
@@ -493,14 +493,16 @@
def _is_ipv6_enabled():
"""Check whether IPv6 is enabled on this host."""
if socket.has_ipv6:
+ sock = None
try:
sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
sock.bind(('::1', 0))
+ return True
except (socket.error, socket.gaierror):
pass
- else:
- sock.close()
- return True
+ finally:
+ if sock:
+ sock.close()
return False
IPV6_ENABLED = _is_ipv6_enabled()
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -82,6 +82,12 @@
* C frames that are garbage-collecting
* C frames that are due to the invocation of a PyCFunction
+Tests
+-----
+
+- Issue #15277: Fix a resource leak in support.py when IPv6 is disabled.
+ Patch by Brian Brazil.
+
Build
-----
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list