This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients cecton, pitrou, yselivanov
Date 2017-07-19.17:51:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1500486674.47.0.672866065843.issue30945@psf.upfronthosting.co.za>
In-reply-to
Content
Better than trying to detect IPv6 compatibility beforehand would probably to recognize the error and simply ignore it.

Note: errno 99 is EADDRNOTAVAIL.

Something like this could work (untested):

diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index 33b8f48..413161a 100644
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -1038,6 +1038,11 @@ class BaseEventLoop(events.AbstractEventLoop):
                     try:
                         sock.bind(sa)
                     except OSError as err:
+                        if err.errno == errno.EADDRNOTAVAIL:
+                            # See bpo-30945
+                            sockets.pop()
+                            sock.close()
+                            continue
                         raise OSError(err.errno, 'error while attempting '
                                       'to bind on address %r: %s'
                                       % (sa, err.strerror.lower())) from None
History
Date User Action Args
2017-07-19 17:51:14pitrousetrecipients: + pitrou, yselivanov, cecton
2017-07-19 17:51:14pitrousetmessageid: <1500486674.47.0.672866065843.issue30945@psf.upfronthosting.co.za>
2017-07-19 17:51:14pitroulinkissue30945 messages
2017-07-19 17:51:14pitroucreate