Skip to content

Commit 3998554

Browse files
authored
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
1 parent 070f1e2 commit 3998554

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/test/support/smtpd.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,8 @@ def __init__(self, localaddr, remoteaddr,
633633
" be set to True at the same time")
634634
asyncore.dispatcher.__init__(self, map=map)
635635
try:
636-
gai_results = socket.getaddrinfo(*localaddr,
636+
family = 0 if socket.has_ipv6 else socket.AF_INET
637+
gai_results = socket.getaddrinfo(*localaddr, family=family,
637638
type=socket.SOCK_STREAM)
638639
self.create_socket(gai_results[0][0], gai_results[0][1])
639640
# try to re-use a server port if possible

0 commit comments

Comments
 (0)