From 0eff34006329646e4db7d1b49ba30423200580c0 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 17 Feb 2025 10:21:35 +0100 Subject: [PATCH] mypy: Enable new strict_bytes option See https://peps.python.org/pep-0688/#no-special-meaning-for-bytes --- .mypy.ini | 1 + qutebrowser/misc/nativeeventfilter.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.mypy.ini b/.mypy.ini index 59a3f8670..e315f0b13 100644 --- a/.mypy.ini +++ b/.mypy.ini @@ -20,6 +20,7 @@ strict_equality = True warn_unreachable = True disallow_any_unimported = True enable_error_code = ignore-without-code +strict_bytes = True ### Output show_error_context = True diff --git a/qutebrowser/misc/nativeeventfilter.py b/qutebrowser/misc/nativeeventfilter.py index 2b2d3f635..1933dc63f 100644 --- a/qutebrowser/misc/nativeeventfilter.py +++ b/qutebrowser/misc/nativeeventfilter.py @@ -137,7 +137,9 @@ class NativeEventFilter(QAbstractNativeEventFilter): xcb.xcb_disconnect(conn) def nativeEventFilter( - self, evtype: Union[bytes, QByteArray], message: Optional[sip.voidptr] + self, + evtype: Union[QByteArray, bytes, bytearray, memoryview], + message: Optional[sip.voidptr], ) -> tuple[bool, _PointerRetType]: """Handle XCB events.""" # We're only installed when the platform plugin is xcb