Skip to content

Commit

Permalink
[3.13] 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) (#122278)

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 <aisk@users.noreply.github.com>
  • Loading branch information
miss-islington and aisk committed Jul 25, 2024
1 parent 83bfc5b commit d1af4f5
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 @@ -1028,8 +1028,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 @@ -1599,7 +1598,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 d1af4f5

Please sign in to comment.