Skip to content

Commit

Permalink
[3.12] gh-121913: Use str(exc) instead of exc.strerror in `asyncio.ba…
Browse files Browse the repository at this point in the history
…se_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]>
  • Loading branch information
miss-islington and aisk authored Jul 25, 2024
1 parent 02c19f0 commit 0300e33
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Lib/asyncio/base_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,8 +994,7 @@ async def _connect_sock(self, exceptions, addr_info, local_addr_infos=None):
except OSError as exc:
msg = (
f'error while attempting to bind on '
f'address {laddr!r}: '
f'{exc.strerror.lower()}'
f'address {laddr!r}: {str(exc).lower()}'
)
exc = OSError(exc.errno, msg)
my_exceptions.append(exc)
Expand Down Expand Up @@ -1561,7 +1560,7 @@ async def create_server(
except OSError as err:
msg = ('error while attempting '
'to bind on address %r: %s'
% (sa, err.strerror.lower()))
% (sa, str(err).lower()))
if err.errno == errno.EADDRNOTAVAIL:
# Assume the family is not enabled (bpo-30945)
sockets.pop()
Expand Down

0 comments on commit 0300e33

Please sign in to comment.