Open RuABraun opened 4 years ago
@RuABraun Thanks for filing this issue. I see you are indeed correct as the get_addrinfo
function will return 5-tuples with the last element being either a 2-tuple or a 4-tuple, the latter of which we are not handling correctly. However, I think we should be filtering on AF_INET
(which corresponds to the 2-tuple), e.g.
# from socket import AF_INET
for _, _, _, _, (ip, _) in getaddrinfo(getfqdn(), 0, AF_INET):
...
This way, the unpacking that assigns to the ip
variable will be left intact. It is more readable, in my opinion.
@RuABraun Do you think this makes sense? And, if you are able to try with this instead, it would be much appreciated. I'd like to know that it works for you.
Python 3.7.6, running example:
I fixed it by changing the code to