Description: Avoid test failures when the kernel doesn't support SO_REUSEPORT
 If Python was compiled on a machine with SO_REUSEPORT support, it'll be in the
 socket module, but that doesn't mean it's available in the running kernel.
 So avoid tripping over ENOPROTOOPT in this situation.
Author: Stefano Rivera <stefanor@debian.org>
Bug-Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=913732
Forwarded: no
Last-Updated: 2013-05-17

--- a/lib-python/2.7/test/test_support.py
+++ b/lib-python/2.7/test/test_support.py
@@ -329,9 +329,13 @@
                 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 socket.error as e:
+                if e.errno != errno.ENOPROTOOPT:
+                    raise
         if hasattr(socket, 'SO_EXCLUSIVEADDRUSE'):
             sock.setsockopt(socket.SOL_SOCKET, socket.SO_EXCLUSIVEADDRUSE, 1)
 
