Commit 8259b0e7 authored by Gregory P. Smith's avatar Gregory P. Smith

Fix test.test_support.bind_port() to not cause an error when Python was

compiled on a system with SO_REUSEPORT defined in the headers but run on
a system with an OS kernel that does not support that new socket option.
parent e1cae038
......@@ -409,9 +409,15 @@ def bind_port(sock, host=HOST):
raise TestFailed("tests should never set the SO_REUSEADDR " \
"socket option on TCP/IP sockets!")
if hasattr(socket, 'SO_REUSEPORT'):
if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1:
raise TestFailed("tests should never set the SO_REUSEPORT " \
"socket option on TCP/IP sockets!")
try:
if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1:
raise TestFailed("tests should never set the SO_REUSEPORT " \
"socket option on TCP/IP sockets!")
except EnvironmentError:
# Python's socket module was compiled using modern headers
# thus defining SO_REUSEPORT but this process is running
# under an older kernel that does not support SO_REUSEPORT.
pass
if hasattr(socket, 'SO_EXCLUSIVEADDRUSE'):
sock.setsockopt(socket.SOL_SOCKET, socket.SO_EXCLUSIVEADDRUSE, 1)
......
......@@ -12,6 +12,10 @@ Core and Builtins
Library
-------
- Fix test.test_support.bind_port() to not cause an error when Python was
compiled on a system with SO_REUSEPORT defined in the headers but run on
a system with an OS kernel that does not support that new socket option.
- Issue #19633: Fixed writing not compressed 16- and 32-bit wave files on
big-endian platforms.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment