Eryk Sun added the comment:

gethostbyname_ex won't do a reverse lookup on an IP to get the fully-qualified 
domain name, which seems pointless for a function named getfqdn. I think 
calling gethostbyaddr is intentional here and goes back to the Python 1.x days.

Also, FYI, socket_gethostbyaddr in socketmodule.c doesn't pass a name to  C 
gethostbyaddr. It first calls setipaddr, which calls getaddrinfo to get the IP 

For "", the reverse lookup on the IP address has no data. Well, 
in Windows the error code is WSANO_DATA; in Linux I get HOST_NOT_FOUND.

nosy: +eryksun

Python tracker <>
Python-bugs-list mailing list

Reply via email to