mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Make socket.getservbyname test optional on socket module having that
attribute. Jython does not have this function. Closes SF patch #403667.
This commit is contained in:
parent
6a12d8d3b4
commit
6870bba459
1 changed files with 6 additions and 5 deletions
|
@ -83,11 +83,12 @@ for name in all_host_names:
|
||||||
else:
|
else:
|
||||||
print 'FQDN not found'
|
print 'FQDN not found'
|
||||||
|
|
||||||
print socket.getservbyname('telnet', 'tcp')
|
if hasattr(socket, 'getservbyname'):
|
||||||
try:
|
print socket.getservbyname('telnet', 'tcp')
|
||||||
socket.getservbyname('telnet', 'udp')
|
try:
|
||||||
except socket.error:
|
socket.getservbyname('telnet', 'udp')
|
||||||
pass
|
except socket.error:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
canfork = hasattr(os, 'fork')
|
canfork = hasattr(os, 'fork')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue