Skip to content

Commit 0300e33

Browse files
miss-islingtonaisk
andauthored
[3.12] gh-121913: Use str(exc) instead of exc.strerror in asyncio.base_events (GH-122269) (#122279)
gh-121913: Use str(exc) instead of exc.strerror in `asyncio.base_events` (GH-122269) (cherry picked from commit 070f1e2) Co-authored-by: AN Long <[email protected]>
1 parent 02c19f0 commit 0300e33

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
@@ -994,8 +994,7 @@ async def _connect_sock(self, exceptions, addr_info, local_addr_infos=None):
994994
except OSError as exc:
995995
msg = (
996996
f'error while attempting to bind on '
997-
f'address {laddr!r}: '
998-
f'{exc.strerror.lower()}'
997+
f'address {laddr!r}: {str(exc).lower()}'
999998
)
1000999
exc = OSError(exc.errno, msg)
10011000
my_exceptions.append(exc)
@@ -1561,7 +1560,7 @@ async def create_server(
15611560
except OSError as err:
15621561
msg = ('error while attempting '
15631562
'to bind on address %r: %s'
1564-
% (sa, err.strerror.lower()))
1563+
% (sa, str(err).lower()))
15651564
if err.errno == errno.EADDRNOTAVAIL:
15661565
# Assume the family is not enabled (bpo-30945)
15671566
sockets.pop()

0 commit comments

Comments
 (0)