diff options
author | Gregory P. Smith <greg@krypto.org> | 2013-11-25 03:42:15 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2013-11-25 03:42:15 (GMT) |
commit | d82634d606583d7e2a55f57be70882a77aba5171 (patch) | |
tree | 130a648008669f1d3ff616c440817db53c74561a | |
parent | 2612679ddc202ff684ea525142d2802c962b4f64 (diff) | |
download | cpython-d82634d606583d7e2a55f57be70882a77aba5171.zip cpython-d82634d606583d7e2a55f57be70882a77aba5171.tar.gz cpython-d82634d606583d7e2a55f57be70882a77aba5171.tar.bz2 |
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.
-rw-r--r-- | Lib/test/test_support.py | 12 | ||||
-rw-r--r-- | Misc/NEWS | 4 |
2 files changed, 13 insertions, 3 deletions
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index e3dd712..d82edb0 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -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. |