summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAN Long <aisk@users.noreply.github.com>2024-07-25 12:03:39 (GMT)
committerGitHub <noreply@github.com>2024-07-25 12:03:39 (GMT)
commit3998554bb05f5ce18e8a66492d23d094a2299442 (patch)
treecfe7b07bb7c096f4a0ebe3f6f9952d871dbca839 /Lib
parent070f1e2e5b9b31ee3e7a1af2e30d7e3a66040b17 (diff)
downloadcpython-3998554bb05f5ce18e8a66492d23d094a2299442.zip
cpython-3998554bb05f5ce18e8a66492d23d094a2299442.tar.gz
cpython-3998554bb05f5ce18e8a66492d23d094a2299442.tar.bz2
gh-121275: Fix test_logging and test_smtplib with Python build withoud IPv6 support (#121276)
Fix test_logging and test_smtplib with Python build withoud IPv6 support
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/test/support/smtpd.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/support/smtpd.py b/Lib/test/support/smtpd.py
index c2e17ca..6537679 100755
--- a/Lib/test/support/smtpd.py
+++ b/Lib/test/support/smtpd.py
@@ -633,7 +633,8 @@ class SMTPServer(asyncore.dispatcher):
" be set to True at the same time")
asyncore.dispatcher.__init__(self, map=map)
try:
- gai_results = socket.getaddrinfo(*localaddr,
+ family = 0 if socket.has_ipv6 else socket.AF_INET
+ gai_results = socket.getaddrinfo(*localaddr, family=family,
type=socket.SOCK_STREAM)
self.create_socket(gai_results[0][0], gai_results[0][1])
# try to re-use a server port if possible