https://github.com/python/cpython/commit/3998554bb05f5ce18e8a66492d23d094a2299442
commit: 3998554bb05f5ce18e8a66492d23d094a2299442
branch: main
author: AN Long <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2024-07-25T17:33:39+05:30
summary:

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

files:
M Lib/test/support/smtpd.py

diff --git a/Lib/test/support/smtpd.py b/Lib/test/support/smtpd.py
index c2e17cad422861..6537679db9ad24 100755
--- a/Lib/test/support/smtpd.py
+++ b/Lib/test/support/smtpd.py
@@ -633,7 +633,8 @@ def __init__(self, localaddr, remoteaddr,
                              " 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

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to