From bdbbb93cd2120d8d58108da2b5fe72d65bff19f7 Mon Sep 17 00:00:00 2001 From: toofar Date: Sun, 28 Apr 2024 12:40:42 +1200 Subject: fix lint, add cheroot log ignores mypy: Mypy knows about the QDataStream.Status.SizeLimitExceeded attribute now, so we can remove the ignore. But mypy for pyqt5 doesn't know about it, so put the whole graceful block behind an additional conditional as well to hide it from pyqt5 mypy. cheroot: looks like the format of the error message we are already ignoring changed slightly. The `ssl/tls` bit changed to `sslv3`, at least in our setup. --- qutebrowser/utils/qtutils.py | 17 +++++++++-------- tests/end2end/fixtures/webserver.py | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/qutebrowser/utils/qtutils.py b/qutebrowser/utils/qtutils.py index 21f3b8478..c1f05b78d 100644 --- a/qutebrowser/utils/qtutils.py +++ b/qutebrowser/utils/qtutils.py @@ -193,14 +193,15 @@ def check_qdatastream(stream: QDataStream) -> None: QDataStream.Status.WriteFailed: ("The data stream cannot write to the " "underlying device."), } - try: - status_to_str[QDataStream.Status.SizeLimitExceeded] = ( # type: ignore[attr-defined] - "The data stream cannot read or write the data because its size is larger " - "than supported by the current platform." - ) - except AttributeError: - # Added in Qt 6.7 - pass + if machinery.IS_QT6: + try: + status_to_str[QDataStream.Status.SizeLimitExceeded] = ( + "The data stream cannot read or write the data because its size is larger " + "than supported by the current platform." + ) + except AttributeError: + # Added in Qt 6.7 + pass if stream.status() != QDataStream.Status.Ok: raise OSError(status_to_str[stream.status()]) diff --git a/tests/end2end/fixtures/webserver.py b/tests/end2end/fixtures/webserver.py index 924cb520b..b70401745 100644 --- a/tests/end2end/fixtures/webserver.py +++ b/tests/end2end/fixtures/webserver.py @@ -116,7 +116,7 @@ def is_ignored_webserver_message(line: str) -> bool: return testutils.pattern_match( pattern=( "Client ('127.0.0.1', *) lost — peer dropped the TLS connection suddenly, " - "during handshake: (1, '[SSL: SSLV3_ALERT_CERTIFICATE_UNKNOWN] ssl/tls " + "during handshake: (1, '[SSL: SSLV3_ALERT_CERTIFICATE_UNKNOWN] * " "alert certificate unknown (_ssl.c:*)')" ), value=line, -- cgit v1.2.3-54-g00ecf