Skip to content

Commit 070f1e2

Browse files
authored
gh-121913: Use str(exc) instead of exc.strerror in asyncio.base_events (#122269)
1 parent 6c09b8d commit 070f1e2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Lib/asyncio/base_events.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,8 +1028,7 @@ async def _connect_sock(self, exceptions, addr_info, local_addr_infos=None):
10281028
except OSError as exc:
10291029
msg = (
10301030
f'error while attempting to bind on '
1031-
f'address {laddr!r}: '
1032-
f'{exc.strerror.lower()}'
1031+
f'address {laddr!r}: {str(exc).lower()}'
10331032
)
10341033
exc = OSError(exc.errno, msg)
10351034
my_exceptions.append(exc)
@@ -1599,7 +1598,7 @@ async def create_server(
15991598
except OSError as err:
16001599
msg = ('error while attempting '
16011600
'to bind on address %r: %s'
1602-
% (sa, err.strerror.lower()))
1601+
% (sa, str(err).lower()))
16031602
if err.errno == errno.EADDRNOTAVAIL:
16041603
# Assume the family is not enabled (bpo-30945)
16051604
sockets.pop()

0 commit comments

Comments
 (0)