From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:15:22 +0000 (+0200) Subject: [3.12] gh-121913: Use str(exc) instead of exc.strerror in `asyncio.base_events` ... X-Git-Tag: v3.12.5~52 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0300e33b223a6cfd691bea186cd413424162d83a;p=thirdparty%2FPython%2Fcpython.git [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 070f1e2e5b9b31ee3e7a1af2e30d7e3a66040b17) Co-authored-by: AN Long --- diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index 29eff0499cb1..cb037fd472c5 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -994,8 +994,7 @@ class BaseEventLoop(events.AbstractEventLoop): 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) @@ -1561,7 +1560,7 @@ class BaseEventLoop(events.AbstractEventLoop): 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()