File tree 2 files changed +19
-3
lines changed 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 16
16
import collections
17
17
import collections .abc
18
18
import concurrent .futures
19
+ import errno
19
20
import functools
20
21
import heapq
21
22
import itertools
@@ -1556,9 +1557,22 @@ async def create_server(
1556
1557
try :
1557
1558
sock .bind (sa )
1558
1559
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
+
1562
1576
completed = True
1563
1577
finally :
1564
1578
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