File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 1616import collections
1717import collections .abc
1818import concurrent .futures
19+ import errno
1920import functools
2021import heapq
2122import itertools
@@ -1556,9 +1557,22 @@ async def create_server(
15561557 try :
15571558 sock .bind (sa )
15581559 except OSError as err :
1559- raise OSError (err .errno , 'error while attempting '
1560- 'to bind on address %r: %s'
1561- % (sa , err .strerror .lower ())) from None
1560+ msg = ('error while attempting '
1561+ 'to bind on address %r: %s'
1562+ % (sa , err .strerror .lower ()))
1563+ if err .errno == errno .EADDRNOTAVAIL :
1564+ # Assume the family is not enabled (bpo-30945)
1565+ sockets .pop ()
1566+ sock .close ()
1567+ if self ._debug :
1568+ logger .warning (msg )
1569+ continue
1570+ raise OSError (err .errno , msg ) from None
1571+
1572+ if not sockets :
1573+ raise OSError ('could not bind on any address out of %r'
1574+ % ([info [4 ] for info in infos ],))
1575+
15621576 completed = True
15631577 finally :
15641578 if not completed :
Original file line number Diff line number Diff line change 1+ Ignore an :exc: `OSError ` in :meth: `asyncio.BaseEventLoop.create_server ` when
2+ IPv6 is available but the interface cannot actually support it.
You can’t perform that action at this time.
0 commit comments