summaryrefslogtreecommitdiffstats
path: root/Lib/test/support
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-08-21 22:39:46 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-08-21 22:39:46 (GMT)
commitf6fbf5607155b2dcd517059c8067305c4d015b00 (patch)
tree49d363b0218c7c9d8c36a64f029ca45ed49cf905 /Lib/test/support
parent13423c3726ac4aa42125ac49e6c5038a015fe3eb (diff)
downloadcpython-f6fbf5607155b2dcd517059c8067305c4d015b00.zip
cpython-f6fbf5607155b2dcd517059c8067305c4d015b00.tar.gz
cpython-f6fbf5607155b2dcd517059c8067305c4d015b00.tar.bz2
Issue #18792: Use "127.0.0.1" or "::1" instead of "localhost" as much as possible, since "localhost" goes through a DNS lookup under recent Windows versions.
Diffstat (limited to 'Lib/test/support')
-rw-r--r--Lib/test/support/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index befbe8b..02ea298 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -480,7 +480,11 @@ def requires_mac_ver(*min_version):
return decorator
-HOST = 'localhost'
+# Don't use "localhost", since resolving it uses the DNS under recent
+# Windows versions (see issue #18792).
+HOST = "127.0.0.1"
+HOSTv6 = "::1"
+
def find_unused_port(family=socket.AF_INET, socktype=socket.SOCK_STREAM):
"""Returns an unused port that should be suitable for binding. This is