Skip to content

Commit

Permalink
pythongh-121913: Use str(exc) instead of exc.strerror in `asyncio.bas…
Browse files Browse the repository at this point in the history
…e_events` (pythonGH-122269)

(cherry picked from commit 070f1e2)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
  • Loading branch information
aisk authored and miss-islington committed Jul 25, 2024
1 parent 83bfc5b commit 658de64
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 658de64

Please sign in to comment.