From 6870bba459a7c30908c8640b20023e9817e8ac53 Mon Sep 17 00:00:00 2001
From: Barry Warsaw <barry@python.org>
Date: Fri, 23 Mar 2001 17:40:16 +0000
Subject: Make socket.getservbyname test optional on socket module having that
 attribute.  Jython does not have this function.

Closes SF patch #403667.
---
 Lib/test/test_socket.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 00a4a91..10cd5d8 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -83,11 +83,12 @@ for name in all_host_names:
 else:
     print 'FQDN not found'
 
-print socket.getservbyname('telnet', 'tcp')
-try:
-    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')
-- 
cgit v0.12

