Erwan Le Pape <lepaperw...@gmail.com> added the comment:

While the 3.7+ getaddrinfo isn't the best human representation of an IPv6 
address, I believe it does make the most sense to keep it that way.
In any case, this is a regression and changing return values of getaddrinfo for 
3.7 isn't something that should be considered.

The issue stems from the refactoring of the underlying socketmodule.c handling 
of IPv4/IPv6 addresses with dedicated make_ipv4_addr and make_ipv6_addr 
functions which returns proper tuples of:
  str/int for IPv4: 
https://github.com/python/cpython/blob/master/Modules/socketmodule.c#L1270
  str/int/int/int for IPv6: 
https://github.com/python/cpython/blob/master/Modules/socketmodule.c#L1325

The actual issue is that _ensure_resolved naively assumes IPv4 and truncates 
the address to its first 2 members
https://github.com/python/cpython/blob/3.7/Lib/asyncio/base_events.py#L1269
and never redefines them again in the case where they were set.

I'd suggest passing the remaining elements of address in a packed *args or an 
optional flowinfo=0, scopeid=0 to _ipaddr_info since fundamentally, that's the 
method stripping valuable information.

----------
nosy: +lepaperwan

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35545>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to