diff options
author | Barry Warsaw <barry@python.org> | 2001-03-23 17:40:16 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2001-03-23 17:40:16 (GMT) |
commit | 6870bba459a7c30908c8640b20023e9817e8ac53 (patch) | |
tree | 80fc5afdaf8d3100e350fd9902c2f310b386cdd3 /Lib/test/test_socket.py | |
parent | 6a12d8d3b4b7c70f92a17a20cb811b18069fd349 (diff) | |
download | cpython-6870bba459a7c30908c8640b20023e9817e8ac53.zip cpython-6870bba459a7c30908c8640b20023e9817e8ac53.tar.gz cpython-6870bba459a7c30908c8640b20023e9817e8ac53.tar.bz2 |
Make socket.getservbyname test optional on socket module having that
attribute. Jython does not have this function.
Closes SF patch #403667.
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r-- | Lib/test/test_socket.py | 11 |
1 files 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') |