]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-121913: Use str(exc) instead of exc.strerror in `asyncio.base_events` (#122269)
authorAN Long <aisk@users.noreply.github.com>
Thu, 25 Jul 2024 11:56:04 +0000 (19:56 +0800)
committerGitHub <noreply@github.com>
Thu, 25 Jul 2024 11:56:04 +0000 (17:26 +0530)
Lib/asyncio/base_events.py

index f0e690b61a73dd15e6b7696b9148ef4e09b62f01..e4a39f4d345c79088ef939218390740b46287ac0 100644 (file)
@@ -1028,8 +1028,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)
@@ -1599,7 +1598,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()