File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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
@@ -1585,9 +1586,22 @@ async def create_server(
15851586 try :
15861587 sock .bind (sa )
15871588 except OSError as err :
1588- raise OSError (err .errno , 'error while attempting '
1589- 'to bind on address %r: %s'
1590- % (sa , err .strerror .lower ())) from None
1589+ msg = ('error while attempting '
1590+ 'to bind on address %r: %s'
1591+ % (sa , err .strerror .lower ()))
1592+ if err .errno == errno .EADDRNOTAVAIL :
1593+ # Assume the family is not enabled (bpo-30945)
1594+ sockets .pop ()
1595+ sock .close ()
1596+ if self ._debug :
1597+ logger .warning (msg )
1598+ continue
1599+ raise OSError (err .errno , msg ) from None
1600+
1601+ if not sockets :
1602+ raise OSError ('could not bind on any address out of %r'
1603+ % ([info [4 ] for info in infos ],))
1604+
15911605 completed = True
15921606 finally :
15931607 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