]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-121913: Use str(exc) instead of exc.strerror in `asyncio.base_events` ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 25 Jul 2024 12:15:22 +0000 (14:15 +0200)
committerGitHub <noreply@github.com>
Thu, 25 Jul 2024 12:15:22 +0000 (12:15 +0000)
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 <aisk@users.noreply.github.com>
Lib/asyncio/base_events.py

index 29eff0499cb1d69d71343bc5aae13f54183eb1f3..cb037fd472c5aa3bed4b64cfa401cc9889768402 100644 (file)
@@ -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()