Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions Lib/asyncio/base_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import collections
import collections.abc
import concurrent.futures
import errno
import functools
import heapq
import itertools
Expand Down Expand Up @@ -1585,9 +1586,22 @@ async def create_server(
try:
sock.bind(sa)
except OSError as err:
raise OSError(err.errno, 'error while attempting '
'to bind on address %r: %s'
% (sa, err.strerror.lower())) from None
msg = ('error while attempting '
'to bind on address %r: %s'
% (sa, err.strerror.lower()))
if err.errno == errno.EADDRNOTAVAIL:
# Assume the family is not enabled (bpo-30945)
sockets.pop()
sock.close()
if self._debug:
logger.warning(msg)
continue
raise OSError(err.errno, msg) from None

if not sockets:
raise OSError('could not bind on any address out of %r'
% ([info[4] for info in infos],))

completed = True
finally:
if not completed:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Ignore an :exc:`OSError` in :meth:`asyncio.BaseEventLoop.create_server` when
IPv6 is available but the interface cannot actually support it.