-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
Closed
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
There is a error sample:
ERROR: test_basic (test.test_logging.SMTPHandlerTest.test_basic)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/asaka/Codes/cpython/Lib/test/test_logging.py", line 1121, in test_basic
server = TestSMTPServer((socket_helper.HOST, 0), self.process_message, 0.001,
sockmap)
File "/home/asaka/Codes/cpython/Lib/test/test_logging.py", line 882, in __init__
smtpd.SMTPServer.__init__(self, addr, None, map=sockmap,
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
decode_data=True)
^^^^^^^^^^^^^^^^^
File "/home/asaka/Codes/cpython/Lib/test/support/smtpd.py", line 641, in __init__
self.bind(localaddr)
~~~~~~~~~^^^^^^^^^^^
File "/home/asaka/Codes/cpython/Lib/test/support/asyncore.py", line 332, in bind
return self.socket.bind(addr)
~~~~~~~~~~~~~~~~^^^^^^
OSError: bind(): bad family
This is caused by SMTPServer is using socket.getaddrinfo to get the socket family, which also include IPv6 result even if IPv6 support is disabled, and it's value will be used to socket.bind:
cpython/Lib/test/support/smtpd.py
Lines 636 to 638 in 6343486
| gai_results = socket.getaddrinfo(*localaddr, | |
| type=socket.SOCK_STREAM) | |
| self.create_socket(gai_results[0][0], gai_results[0][1]) |
--disable-ipv6 must be specified when --with-thread-sanitizer is specified on my machine (Arch with Clang17), so I think it's better to fix it although --disable-ipv6 is not widely used.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error