[Python-bugs-list] [ python-Bugs-523230 ] socket.gethostbyaddrors

noreply@sourceforge.net noreply@sourceforge.net
Thu, 28 Feb 2002 02:12:13 -0800


Bugs item #523230, was opened at 2002-02-27 02:46
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=523230&group_id=5470

Category: Python Library
Group: Python 2.1.1
>Status: Closed
>Resolution: Rejected
Priority: 5
Submitted By: Tim Sharpe (beaststwo)
Assigned to: Nobody/Anonymous (nobody)
Summary: socket.gethostbyaddrors

Initial Comment:
When socket.gethostbyaddr() is given an IP address for 
which no DNS name exists (or if DNS fails to respond 
for some reason), the function abends with 
a "socket.error".

It seems to me that if the function is provided with a 
hostname that can't be resolved, the following 
behavior would be more friendly:

  -If the function can parse the provided hostname as 
a validly-formatted IP address, the function could 
provide the IP address for the (hostname, aliaslist, 
ipaddrlist) result.  Then the user's program can 
continue on to find out if the IP address is valid or 
not.  At least it's a chance to continue execution.

  -If the function is cannot be resolved and cannot be 
parsed and identified as an IP address, then throw an 
exception that specifically identifies this case vice 
a generic "socket.error".  I haven't managed to write 
an exception statement that works with "socket.error", 
although I've successfully used other exceptions.

Even if the "powers that be" feel all hosts should 
have a DNS address, library functions shouldn't fail 
just because system owners aren't willing to provide 
names to all hosts.

Thanks...

Tim Sharpe 

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2002-02-28 11:12

Message:
Logged In: YES 
user_id=21627

The library function you are calling is specifically
designed to return the hostname. If it cannot do what it is
designed to do, it must fail; failure is indicated in Python
with an exception.

If the application specifically asks for the host name, it
should expect that to fail. If there is meaningful
processing possible in case of failure, the application can
catch the exception, and perform that processing. I cannot
see the flaw in the function, and your proposed change is
backwards-incompatible - so this change request (what it
really is) is rejected.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=523230&group_id=5470