summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2024-03-26 13:57:07 +0100
committerFlorian Bruhin <me@the-compiler.org>2024-03-26 13:57:07 +0100
commitd37f5b7be0d8ece8d29e020b22b3eec12b2150fa (patch)
tree575569f8ca11c9f1ad6a10fd5a63db2cc0faab63
parent1ee138b681a590ee500954361eed2cf923b1d8a0 (diff)
downloadqutebrowser-d37f5b7be0d8ece8d29e020b22b3eec12b2150fa.tar.gz
qutebrowser-d37f5b7be0d8ece8d29e020b22b3eec12b2150fa.zip
Ignore already imported Qt module with PyInstaller
Starting with PyInstaller 6.5.0, it imports Qt bindings early, due to this change: https://github.com/pyinstaller/pyinstaller/pull/8315 We warn about this in order to avoid unintentional early Qt imports in qutebrowser. However, in the case of using PyInstaller, we just suppress the warning now, as it's not us to blame. See https://github.com/qutebrowser/qutebrowser/pull/8123
-rw-r--r--qutebrowser/qt/machinery.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/qutebrowser/qt/machinery.py b/qutebrowser/qt/machinery.py
index f9e3721f8..9f45dd6ce 100644
--- a/qutebrowser/qt/machinery.py
+++ b/qutebrowser/qt/machinery.py
@@ -168,9 +168,9 @@ def _select_wrapper(args: Optional[argparse.Namespace]) -> SelectionInfo:
- Otherwise, try the wrappers in WRAPPER in order (PyQt6 -> PyQt5)
"""
# If any Qt wrapper has been imported before this, something strange might
- # be happening.
+ # be happening. With PyInstaller, it imports the Qt bindings early.
for name in WRAPPERS:
- if name in sys.modules:
+ if name in sys.modules and not hasattr(sys, "frozen"):
warnings.warn(f"{name} already imported", stacklevel=1)
if args is not None and args.qt_wrapper is not None: