diff --git a/qutebrowser/app.py b/qutebrowser/app.py index e67d9d6f7..3383709d2 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -21,10 +21,18 @@ import os import sys import logging import subprocess -import faulthandler from signal import signal, SIGINT from argparse import ArgumentParser +# Print a nice traceback on segfault -- only available on Python 3.3+, but if +# it's unavailable, it doesn't matter much. +try: + import faulthandler +except ImportError: + pass +else: + faulthandler.enable() + # This is a really old place to do this, but we have to do this before # importing PyQt or it won't work. # See https://bugreports.qt-project.org/browse/QTBUG-36099 @@ -66,9 +74,6 @@ class QuteBrowser(QApplication): super().__init__(sys.argv) sys.excepthook = self._exception_hook - # Handle segfaults - faulthandler.enable() - self._parseopts() self._initlog() self._initmisc()