bay <b...@hackerdom.ru> added the comment:
The bug is reproducible on Python 3.7. The connect call always fails when I try to use connect to any IPv6 address with ProactorEventLoop. The bug can be bypassed by adding "%0" to the IPv6 address. This will cause to trigger this if construction: https://github.com/python/cpython/blob/e76ac9d4ef77b74ea7de768f4de7c38893fad539/Lib/asyncio/base_events.py#L133 As mentioned by Sebastian, it happen because the _ipaddr_info function returns only the host and the port for IPv6: return af, type, proto, '', (host, port) https://github.com/python/cpython/blob/e76ac9d4ef77b74ea7de768f4de7c38893fad539/Lib/asyncio/base_events.py#L142 This (host, port) tuple used in ConnectEx call, but it expect 4-element tuple to connect IPv6: https://github.com/python/cpython/blob/55edd0c185ad2d895b5d73e47d67049bc156b654/Modules/overlapped.c#L1090 Instead it tries to connect, using IPv4 and fails. The bug can be fixed by doing the following: if af == socket.AF_INET6: return af, type, proto, '', (host, port, 0, 0) else: return af, type, proto, '', (host, port) instead of return af, type, proto, '', (host, port) in https://github.com/python/cpython/blob/e76ac9d4ef77b74ea7de768f4de7c38893fad539/Lib/asyncio/base_events.py#L142 ---------- nosy: +bay _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue27500> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com