Barry Warsaw  committed c8817a9

Make socket.getservbyname test optional on socket module having that
attribute. Jython does not have this function.

Closes SF patch #403667.

  • Participants
  • Parent commits 16f145a
  • Branches legacy-trunk

Comments (0)

Files changed (1)

File Lib/test/

     print 'FQDN not found'
-print socket.getservbyname('telnet', 'tcp')
-    socket.getservbyname('telnet', 'udp')
-except socket.error:
-    pass
+if hasattr(socket, 'getservbyname'):
+    print socket.getservbyname('telnet', 'tcp')
+    try:
+        socket.getservbyname('telnet', 'udp')
+    except socket.error:
+        pass
 canfork = hasattr(os, 'fork')