gurudesh/pytracebugs huggingface dataset:
# Buggy code
def _on_config_changed(self, option):
    if option == "tabs.favicons.show":
        self._update_favicons()
    elif option == "window.title_format":
        self._update_window_title()
    elif option in ["tabs.title.format", "tabs.title.format_pinned"]:
        self._update_tab_titles()


# Traceback (ValueError)
16:39:44 DEBUG    init       app:_init_modules:468 Initializing websettings...
16:39:45 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/bin/qutebrowser", line 11, in <module>
load_entry_point('qutebrowser==1.1.1', 'gui_scripts', 'qutebrowser')()
File "/usr/lib/python3.6/site-packages/qutebrowser/qutebrowser.py", line 188, in main
return app.run(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 137, in run
init(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 163, in init
_init_modules(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 469, in _init_modules
websettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 215, in init
webenginesettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 297, in init
websettings.init_mappings(MAPPINGS)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 198, in init_mappings
mapping.set(value)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 72, in set
self._set(value, settings=settings)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in _set
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in <listcomp>
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 143, in _find_installed
local_filename = spell.local_filename(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 64, in local_filename
all_installed = local_files(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 51, in local_files
for matching_dict in sorted(matching_dicts, key=version, reverse=True):
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 36, in version
.format(filename))
ValueError: the given dictionary file name is malformed: /usr/share/qt/qtwebengine_dictionaries/en-US.bdic

# Fixed code
def _on_config_changed(self, option):
    if option == "tabs.favicons.show":
        self._update_favicons()
    elif option == "window.title_format":
        self._update_window_title()
    elif option in ["tabs.title.format", "tabs.title.format_pinned"]:
        self.widget.update_tab_titles()
# Buggy code
def widgets(self):
    """Get a list of open tab widgets.

    We don't implement this as generator so we can delete tabs while
    iterating over the list.
    """
    widgets = []
    for i in range(self.count()):
        widget = self.widget(i)
        if widget is None:
            log.webview.debug("Got None-widget in tabbedbrowser!")
        else:
            widgets.append(widget)
    return widgets


# Traceback (ValueError)
16:39:44 DEBUG    init       app:_init_modules:468 Initializing websettings...
16:39:45 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/bin/qutebrowser", line 11, in <module>
load_entry_point('qutebrowser==1.1.1', 'gui_scripts', 'qutebrowser')()
File "/usr/lib/python3.6/site-packages/qutebrowser/qutebrowser.py", line 188, in main
return app.run(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 137, in run
init(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 163, in init
_init_modules(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 469, in _init_modules
websettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 215, in init
webenginesettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 297, in init
websettings.init_mappings(MAPPINGS)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 198, in init_mappings
mapping.set(value)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 72, in set
self._set(value, settings=settings)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in _set
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in <listcomp>
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 143, in _find_installed
local_filename = spell.local_filename(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 64, in local_filename
all_installed = local_files(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 51, in local_files
for matching_dict in sorted(matching_dicts, key=version, reverse=True):
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 36, in version
.format(filename))
ValueError: the given dictionary file name is malformed: /usr/share/qt/qtwebengine_dictionaries/en-US.bdic

# Fixed code
def widgets(self):
    """Get a list of open tab widgets.

    We don't implement this as generator so we can delete tabs while
    iterating over the list.
    """
    widgets = []
    for i in range(self.widget.count()):
        widget = self.widget.widget(i)
        if widget is None:
            log.webview.debug("Got None-widget in tabbedbrowser!")
        else:
            widgets.append(widget)
    return widgets
# Buggy code
def current_url(self):
    """Get the URL of the current tab.

    Intended to be used from command handlers.

    Return:
        The current URL as QUrl.
    """
    idx = self.currentIndex()
    return super().tab_url(idx)


# Traceback (ValueError)
16:39:44 DEBUG    init       app:_init_modules:468 Initializing websettings...
16:39:45 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/bin/qutebrowser", line 11, in <module>
load_entry_point('qutebrowser==1.1.1', 'gui_scripts', 'qutebrowser')()
File "/usr/lib/python3.6/site-packages/qutebrowser/qutebrowser.py", line 188, in main
return app.run(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 137, in run
init(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 163, in init
_init_modules(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 469, in _init_modules
websettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 215, in init
webenginesettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 297, in init
websettings.init_mappings(MAPPINGS)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 198, in init_mappings
mapping.set(value)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 72, in set
self._set(value, settings=settings)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in _set
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in <listcomp>
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 143, in _find_installed
local_filename = spell.local_filename(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 64, in local_filename
all_installed = local_files(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 51, in local_files
for matching_dict in sorted(matching_dicts, key=version, reverse=True):
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 36, in version
.format(filename))
ValueError: the given dictionary file name is malformed: /usr/share/qt/qtwebengine_dictionaries/en-US.bdic

# Fixed code
def current_url(self):
    """Get the URL of the current tab.

    Intended to be used from command handlers.

    Return:
        The current URL as QUrl.
    """
    idx = self.widget.currentIndex()
    return self.widget.tab_url(idx)
# Buggy code
def openurl(self, url, newtab):
    """Open a URL, used as a slot.

    Args:
        url: The URL to open as QUrl.
        newtab: True to open URL in a new tab, False otherwise.
    """
    qtutils.ensure_valid(url)
    if newtab or self.currentWidget() is None:
        self.tabopen(url, background=False)
    else:
        self.currentWidget().openurl(url)


# Traceback (ValueError)
16:39:44 DEBUG    init       app:_init_modules:468 Initializing websettings...
16:39:45 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/bin/qutebrowser", line 11, in <module>
load_entry_point('qutebrowser==1.1.1', 'gui_scripts', 'qutebrowser')()
File "/usr/lib/python3.6/site-packages/qutebrowser/qutebrowser.py", line 188, in main
return app.run(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 137, in run
init(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 163, in init
_init_modules(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 469, in _init_modules
websettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 215, in init
webenginesettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 297, in init
websettings.init_mappings(MAPPINGS)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 198, in init_mappings
mapping.set(value)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 72, in set
self._set(value, settings=settings)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in _set
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in <listcomp>
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 143, in _find_installed
local_filename = spell.local_filename(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 64, in local_filename
all_installed = local_files(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 51, in local_files
for matching_dict in sorted(matching_dicts, key=version, reverse=True):
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 36, in version
.format(filename))
ValueError: the given dictionary file name is malformed: /usr/share/qt/qtwebengine_dictionaries/en-US.bdic

# Fixed code
def openurl(self, url, newtab):
    """Open a URL, used as a slot.

    Args:
        url: The URL to open as QUrl.
        newtab: True to open URL in a new tab, False otherwise.
    """
    qtutils.ensure_valid(url)
    if newtab or self.widget.currentWidget() is None:
        self.tabopen(url, background=False)
    else:
        self.widget.currentWidget().openurl(url)
# Buggy code
def on_tab_close_requested(self, idx):
    """Close a tab via an index."""
    tab = self.widget(idx)
    if tab is None:
        log.webview.debug("Got invalid tab {} for index {}!".format(tab, idx))
        return
    self.tab_close_prompt_if_pinned(tab, False, lambda: self.close_tab(tab))


# Traceback (ValueError)
16:39:44 DEBUG    init       app:_init_modules:468 Initializing websettings...
16:39:45 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/bin/qutebrowser", line 11, in <module>
load_entry_point('qutebrowser==1.1.1', 'gui_scripts', 'qutebrowser')()
File "/usr/lib/python3.6/site-packages/qutebrowser/qutebrowser.py", line 188, in main
return app.run(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 137, in run
init(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 163, in init
_init_modules(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 469, in _init_modules
websettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 215, in init
webenginesettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 297, in init
websettings.init_mappings(MAPPINGS)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 198, in init_mappings
mapping.set(value)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 72, in set
self._set(value, settings=settings)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in _set
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in <listcomp>
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 143, in _find_installed
local_filename = spell.local_filename(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 64, in local_filename
all_installed = local_files(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 51, in local_files
for matching_dict in sorted(matching_dicts, key=version, reverse=True):
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 36, in version
.format(filename))
ValueError: the given dictionary file name is malformed: /usr/share/qt/qtwebengine_dictionaries/en-US.bdic

# Fixed code
def on_tab_close_requested(self, idx):
    """Close a tab via an index."""
    tab = self.widget.widget(idx)
    if tab is None:
        log.webview.debug("Got invalid tab {} for index {}!".format(tab, idx))
        return
    self.tab_close_prompt_if_pinned(tab, False, lambda: self.close_tab(tab))
# Buggy code
def _update_favicons(self):
    """Update favicons when config was changed."""
    for i, tab in enumerate(self.widgets()):
        if config.val.tabs.favicons.show:
            self.setTabIcon(i, tab.icon())
            if config.val.tabs.tabs_are_windows:
                self.window().setWindowIcon(tab.icon())
        else:
            self.setTabIcon(i, QIcon())
            if config.val.tabs.tabs_are_windows:
                self.window().setWindowIcon(self.default_window_icon)


# Traceback (ValueError)
16:39:44 DEBUG    init       app:_init_modules:468 Initializing websettings...
16:39:45 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/bin/qutebrowser", line 11, in <module>
load_entry_point('qutebrowser==1.1.1', 'gui_scripts', 'qutebrowser')()
File "/usr/lib/python3.6/site-packages/qutebrowser/qutebrowser.py", line 188, in main
return app.run(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 137, in run
init(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 163, in init
_init_modules(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 469, in _init_modules
websettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 215, in init
webenginesettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 297, in init
websettings.init_mappings(MAPPINGS)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 198, in init_mappings
mapping.set(value)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 72, in set
self._set(value, settings=settings)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in _set
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in <listcomp>
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 143, in _find_installed
local_filename = spell.local_filename(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 64, in local_filename
all_installed = local_files(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 51, in local_files
for matching_dict in sorted(matching_dicts, key=version, reverse=True):
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 36, in version
.format(filename))
ValueError: the given dictionary file name is malformed: /usr/share/qt/qtwebengine_dictionaries/en-US.bdic

# Fixed code
def _update_favicons(self):
    """Update favicons when config was changed."""
    for tab in self.widgets():
        self.widget.update_tab_favicon(tab)
# Buggy code
def on_mode_left(self, mode):
    """Give focus to current tab if command mode was left."""
    if mode in [
        usertypes.KeyMode.command,
        usertypes.KeyMode.prompt,
        usertypes.KeyMode.yesno,
    ]:
        widget = self.currentWidget()
        log.modes.debug("Left status-input mode, focusing {!r}".format(widget))
        if widget is None:
            return
        widget.setFocus()


# Traceback (ValueError)
16:39:44 DEBUG    init       app:_init_modules:468 Initializing websettings...
16:39:45 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/bin/qutebrowser", line 11, in <module>
load_entry_point('qutebrowser==1.1.1', 'gui_scripts', 'qutebrowser')()
File "/usr/lib/python3.6/site-packages/qutebrowser/qutebrowser.py", line 188, in main
return app.run(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 137, in run
init(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 163, in init
_init_modules(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 469, in _init_modules
websettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 215, in init
webenginesettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 297, in init
websettings.init_mappings(MAPPINGS)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 198, in init_mappings
mapping.set(value)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 72, in set
self._set(value, settings=settings)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in _set
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in <listcomp>
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 143, in _find_installed
local_filename = spell.local_filename(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 64, in local_filename
all_installed = local_files(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 51, in local_files
for matching_dict in sorted(matching_dicts, key=version, reverse=True):
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 36, in version
.format(filename))
ValueError: the given dictionary file name is malformed: /usr/share/qt/qtwebengine_dictionaries/en-US.bdic

# Fixed code
def on_mode_left(self, mode):
    """Give focus to current tab if command mode was left."""
    if mode in [
        usertypes.KeyMode.command,
        usertypes.KeyMode.prompt,
        usertypes.KeyMode.yesno,
    ]:
        widget = self.widget.currentWidget()
        log.modes.debug("Left status-input mode, focusing {!r}".format(widget))
        if widget is None:
            return
        widget.setFocus()
# Buggy code
def on_scroll_pos_changed(self):
    """Update tab and window title when scroll position changed."""
    idx = self.currentIndex()
    if idx == -1:
        # (e.g. last tab removed)
        log.webview.debug("Not updating scroll position because index is -1")
        return
    self._update_window_title("scroll_pos")
    self._update_tab_title(idx, "scroll_pos")


# Traceback (ValueError)
16:39:44 DEBUG    init       app:_init_modules:468 Initializing websettings...
16:39:45 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/bin/qutebrowser", line 11, in <module>
load_entry_point('qutebrowser==1.1.1', 'gui_scripts', 'qutebrowser')()
File "/usr/lib/python3.6/site-packages/qutebrowser/qutebrowser.py", line 188, in main
return app.run(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 137, in run
init(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 163, in init
_init_modules(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 469, in _init_modules
websettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 215, in init
webenginesettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 297, in init
websettings.init_mappings(MAPPINGS)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 198, in init_mappings
mapping.set(value)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 72, in set
self._set(value, settings=settings)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in _set
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in <listcomp>
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 143, in _find_installed
local_filename = spell.local_filename(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 64, in local_filename
all_installed = local_files(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 51, in local_files
for matching_dict in sorted(matching_dicts, key=version, reverse=True):
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 36, in version
.format(filename))
ValueError: the given dictionary file name is malformed: /usr/share/qt/qtwebengine_dictionaries/en-US.bdic

# Fixed code
def on_scroll_pos_changed(self):
    """Update tab and window title when scroll position changed."""
    idx = self.widget.currentIndex()
    if idx == -1:
        # (e.g. last tab removed)
        log.webview.debug("Not updating scroll position because index is -1")
        return
    self._update_window_title("scroll_pos")
    self.widget.update_tab_title(idx, "scroll_pos")
# Buggy code
def set_tab_pinned(self, tab: QWidget, pinned: bool) -> None:
    """Set the tab status as pinned.

    Args:
        tab: The tab to pin
        pinned: Pinned tab state to set.
    """
    bar = self.tabBar()
    idx = self.indexOf(tab)

    bar.set_tab_data(idx, "pinned", pinned)
    tab.data.pinned = pinned
    self._update_tab_title(idx)


# Traceback (ValueError)
16:39:44 DEBUG    init       app:_init_modules:468 Initializing websettings...
16:39:45 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/bin/qutebrowser", line 11, in <module>
load_entry_point('qutebrowser==1.1.1', 'gui_scripts', 'qutebrowser')()
File "/usr/lib/python3.6/site-packages/qutebrowser/qutebrowser.py", line 188, in main
return app.run(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 137, in run
init(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 163, in init
_init_modules(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 469, in _init_modules
websettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 215, in init
webenginesettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 297, in init
websettings.init_mappings(MAPPINGS)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 198, in init_mappings
mapping.set(value)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 72, in set
self._set(value, settings=settings)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in _set
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in <listcomp>
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 143, in _find_installed
local_filename = spell.local_filename(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 64, in local_filename
all_installed = local_files(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 51, in local_files
for matching_dict in sorted(matching_dicts, key=version, reverse=True):
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 36, in version
.format(filename))
ValueError: the given dictionary file name is malformed: /usr/share/qt/qtwebengine_dictionaries/en-US.bdic

# Fixed code
def set_tab_pinned(self, tab: QWidget, pinned: bool) -> None:
    """Set the tab status as pinned.

    Args:
        tab: The tab to pin
        pinned: Pinned tab state to set.
    """
    bar = self.tabBar()
    idx = self.indexOf(tab)

    bar.set_tab_data(idx, "pinned", pinned)
    tab.data.pinned = pinned
    self.update_tab_favicon(tab)
    self.update_tab_title(idx)
# Buggy code
def set_page_title(self, idx, title):
    """Set the tab title user data."""
    self.tabBar().set_tab_data(idx, "page-title", title)
    self._update_tab_title(idx)


# Traceback (ValueError)
16:39:44 DEBUG    init       app:_init_modules:468 Initializing websettings...
16:39:45 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/bin/qutebrowser", line 11, in <module>
load_entry_point('qutebrowser==1.1.1', 'gui_scripts', 'qutebrowser')()
File "/usr/lib/python3.6/site-packages/qutebrowser/qutebrowser.py", line 188, in main
return app.run(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 137, in run
init(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 163, in init
_init_modules(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 469, in _init_modules
websettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 215, in init
webenginesettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 297, in init
websettings.init_mappings(MAPPINGS)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 198, in init_mappings
mapping.set(value)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 72, in set
self._set(value, settings=settings)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in _set
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in <listcomp>
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 143, in _find_installed
local_filename = spell.local_filename(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 64, in local_filename
all_installed = local_files(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 51, in local_files
for matching_dict in sorted(matching_dicts, key=version, reverse=True):
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 36, in version
.format(filename))
ValueError: the given dictionary file name is malformed: /usr/share/qt/qtwebengine_dictionaries/en-US.bdic

# Fixed code
def set_page_title(self, idx, title):
    """Set the tab title user data."""
    self.tabBar().set_tab_data(idx, "page-title", title)
    self.update_tab_title(idx)
# Buggy code
def tabInserted(self, idx):
    """Update titles when a tab was inserted."""
    super().tabInserted(idx)
    self._update_tab_titles()


# Traceback (ValueError)
16:39:44 DEBUG    init       app:_init_modules:468 Initializing websettings...
16:39:45 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/bin/qutebrowser", line 11, in <module>
load_entry_point('qutebrowser==1.1.1', 'gui_scripts', 'qutebrowser')()
File "/usr/lib/python3.6/site-packages/qutebrowser/qutebrowser.py", line 188, in main
return app.run(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 137, in run
init(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 163, in init
_init_modules(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 469, in _init_modules
websettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 215, in init
webenginesettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 297, in init
websettings.init_mappings(MAPPINGS)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 198, in init_mappings
mapping.set(value)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 72, in set
self._set(value, settings=settings)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in _set
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in <listcomp>
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 143, in _find_installed
local_filename = spell.local_filename(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 64, in local_filename
all_installed = local_files(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 51, in local_files
for matching_dict in sorted(matching_dicts, key=version, reverse=True):
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 36, in version
.format(filename))
ValueError: the given dictionary file name is malformed: /usr/share/qt/qtwebengine_dictionaries/en-US.bdic

# Fixed code
def tabInserted(self, idx):
    """Update titles when a tab was inserted."""
    super().tabInserted(idx)
    self.update_tab_titles()
# Buggy code
def tabRemoved(self, idx):
    """Update titles when a tab was removed."""
    super().tabRemoved(idx)
    self._update_tab_titles()


# Traceback (ValueError)
16:39:44 DEBUG    init       app:_init_modules:468 Initializing websettings...
16:39:45 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/bin/qutebrowser", line 11, in <module>
load_entry_point('qutebrowser==1.1.1', 'gui_scripts', 'qutebrowser')()
File "/usr/lib/python3.6/site-packages/qutebrowser/qutebrowser.py", line 188, in main
return app.run(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 137, in run
init(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 163, in init
_init_modules(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 469, in _init_modules
websettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 215, in init
webenginesettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 297, in init
websettings.init_mappings(MAPPINGS)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 198, in init_mappings
mapping.set(value)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 72, in set
self._set(value, settings=settings)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in _set
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in <listcomp>
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 143, in _find_installed
local_filename = spell.local_filename(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 64, in local_filename
all_installed = local_files(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 51, in local_files
for matching_dict in sorted(matching_dicts, key=version, reverse=True):
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 36, in version
.format(filename))
ValueError: the given dictionary file name is malformed: /usr/share/qt/qtwebengine_dictionaries/en-US.bdic

# Fixed code
def tabRemoved(self, idx):
    """Update titles when a tab was removed."""
    super().tabRemoved(idx)
    self.update_tab_titles()
# Buggy code
def from_obj(self, value):
    if value is None:
        return {}

    return {
        self.keytype.from_obj(key): self.valtype.from_obj(val)
        for key, val in value.items()
    }


# Traceback (KeyError)
08:17:55 DEBUG    commands   command:run:486 command called: unbind ['<ctrl+q>']
08:17:55 DEBUG    commands   command:run:501 Calling qutebrowser.config.configcommands.ConfigCommands.unbind(<qutebrowser.config.configcommands.ConfigCommands object at 0x7f0eb37d8ef0>, '<ctrl+q>', mode='normal')
08:17:55 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/home/florian/proj/qutebrowser/git/qutebrowser/commands/runners.py", line 325, in run_safely
self.run(text, count)
File "/home/florian/proj/qutebrowser/git/qutebrowser/commands/runners.py", line 304, in run
result.cmd.run(self._win_id, args, count=count)
File "/home/florian/proj/qutebrowser/git/qutebrowser/commands/command.py", line 502, in run
self.handler(*posargs, **kwargs)
File "/home/florian/proj/qutebrowser/git/qutebrowser/config/configcommands.py", line 189, in unbind
save_yaml=True)
File "/home/florian/proj/qutebrowser/git/qutebrowser/config/config.py", line 217, in unbind
del bindings_commands[mode][str(key)]
KeyError: '<Ctrl+q>'

# Fixed code
def from_obj(self, value):
    return str(keyutils.KeySequence.parse(value))
# Buggy code
def get_bindings_for(self, mode):
    """Get the combined bindings for the given mode."""
    bindings = dict(val.bindings.default[mode])
    for key, binding in val.bindings.commands[mode].items():
        if binding is None:
            bindings.pop(key, None)
        else:
            bindings[key] = binding
    return bindings


# Traceback (AssertionError)
18:43:06 DEBUG    config     config:set_str:400 Setting bindings.commands (type Dict) to {'normal': {'co': ''}} (converted from '{"normal": {"co": ""}}')
18:43:06 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/home/florian/proj/qutebrowser/git/qutebrowser/config/config.py", line 119, in wrapper
return func(wrapper_self)
File "/home/florian/proj/qutebrowser/git/qutebrowser/keyinput/basekeyparser.py", line 279, in _on_config_changed
self._read_config()
File "/home/florian/proj/qutebrowser/git/qutebrowser/keyinput/basekeyparser.py", line 301, in _read_config
assert cmd
AssertionError

# Fixed code
def get_bindings_for(self, mode):
    """Get the combined bindings for the given mode."""
    bindings = dict(val.bindings.default[mode])
    for key, binding in val.bindings.commands[mode].items():
        if not binding:
            bindings.pop(key, None)
        else:
            bindings[key] = binding
    return bindings
# Buggy code
def __init__(self, *, cmd, win_id, parent=None):
    super().__init__(parent)
    self._cmd = cmd
    self._win_id = win_id
    self._timer = QTimer()
    self._timer.setSingleShot(True)
    self._timer.setInterval(0)
    self._timer.timeout.connect(self._update_completion)
    self._last_cursor_pos = None
    self._last_text = None
    self._last_completion_func = None
    self._cmd.update_completion.connect(self.schedule_completion_update)


# Traceback (TypeError)
10:10:35 DEBUG    commands   command:run:485 command called: set-cmd-text ['-s', ':open -t']
10:10:35 DEBUG    commands   command:run:500 Calling qutebrowser.mainwindow.statusbar.command.Command.set_cmd_text_command(<qutebrowser.mainwindow.statusbar.command.Command>, ':open -t', None, True, False, False)
10:10:35 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/qutebrowser/completion/completer.py", line 206, in schedule_completion_update
self._cmd.cursorPosition() > self._last_cursor_pos):
TypeError: '>' not supported between instances of 'int' and 'NoneType'

# Fixed code
def __init__(self, *, cmd, win_id, parent=None):
    super().__init__(parent)
    self._cmd = cmd
    self._win_id = win_id
    self._timer = QTimer()
    self._timer.setSingleShot(True)
    self._timer.setInterval(0)
    self._timer.timeout.connect(self._update_completion)
    self._last_cursor_pos = -1
    self._last_text = None
    self._last_completion_func = None
    self._cmd.update_completion.connect(self.schedule_completion_update)
# Buggy code
def _on_load_finished(self, ok):
    sess_manager = objreg.get("session-manager")
    sess_manager.save_autosave()

    if ok and not self._has_ssl_errors:
        if self.url().scheme() == "https":
            self._set_load_status(usertypes.LoadStatus.success_https)
        else:
            self._set_load_status(usertypes.LoadStatus.success)
    elif ok:
        self._set_load_status(usertypes.LoadStatus.warn)
    else:
        self._set_load_status(usertypes.LoadStatus.error)
    self.load_finished.emit(ok)
    if not self.title():
        self.title_changed.emit(self.url().toDisplayString())

    self.zoom.set_current()


# Traceback (RuntimeError)
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/browsertab.py", line 761, in _on_load_finished
if not self.title():
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginetab.py", line 615, in title
return self._widget.title()
RuntimeError: wrapped C/C++ object of type WebEngineView has been deleted

# Fixed code
def _on_load_finished(self, ok):
    if sip.isdeleted(self._widget):
        # https://github.com/qutebrowser/qutebrowser/issues/3498
        return

    sess_manager = objreg.get("session-manager")
    sess_manager.save_autosave()

    if ok and not self._has_ssl_errors:
        if self.url().scheme() == "https":
            self._set_load_status(usertypes.LoadStatus.success_https)
        else:
            self._set_load_status(usertypes.LoadStatus.success)
    elif ok:
        self._set_load_status(usertypes.LoadStatus.warn)
    else:
        self._set_load_status(usertypes.LoadStatus.error)
    self.load_finished.emit(ok)
    if not self.title():
        self.title_changed.emit(self.url().toDisplayString())

    self.zoom.set_current()
# Buggy code
def _restore_zoom(self):
    if self._saved_zoom is None:
        return
    self.zoom.set_factor(self._saved_zoom)
    self._saved_zoom = None


# Traceback (RuntimeError)
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/browsertab.py", line 761, in _on_load_finished
if not self.title():
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginetab.py", line 615, in title
return self._widget.title()
RuntimeError: wrapped C/C++ object of type WebEngineView has been deleted

# Fixed code
def _restore_zoom(self):
    if sip.isdeleted(self._widget):
        # https://github.com/qutebrowser/qutebrowser/issues/3498
        return
    if self._saved_zoom is None:
        return
    self.zoom.set_factor(self._saved_zoom)
    self._saved_zoom = None
# Buggy code
def edit_command(self, run=False):
    """Open an editor to modify the current command.

    Args:
        run: Run the command if the editor exits successfully.
    """
    ed = editor.ExternalEditor(parent=self)

    def callback(text):
        self.set_cmd_text(text)
        if run:
            self.command_accept()

    ed.editing_finished.connect(callback)
    ed.edit(self.text())


# Traceback (AssertionError)
10:33:50 DEBUG    procs      guiprocess:on_finished:98 Process finished with code 0, status 0.
10:33:50 DEBUG    procs      editor:on_proc_closed:73 Editor closed
10:33:50 DEBUG    procs      editor:on_proc_closed:90 Read back: foo

10:33:50 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/home/florian/proj/qutebrowser/git/qutebrowser/mainwindow/statusbar/command.py", line 179, in callback
self.set_cmd_text(text)
File "/home/florian/proj/qutebrowser/git/qutebrowser/mainwindow/statusbar/command.py", line 86, in set_cmd_text
self.setText(text)
File "/home/florian/proj/qutebrowser/git/qutebrowser/mainwindow/statusbar/command.py", line 212, in setText
"'{}'!".format(text))
AssertionError: setText got called with invalid text 'foo
'!

# Fixed code
def edit_command(self, run=False):
    """Open an editor to modify the current command.

    Args:
        run: Run the command if the editor exits successfully.
    """
    ed = editor.ExternalEditor(parent=self)

    def callback(text):
        if not text or text[0] not in modeparsers.STARTCHARS:
            message.error(
                "command must start with one of {}".format(modeparsers.STARTCHARS)
            )
            return
        self.set_cmd_text(text)
        if run:
            self.command_accept()

    ed.editing_finished.connect(callback)
    ed.edit(self.text())
# Buggy code
def callback(text):
    self.set_cmd_text(text)
    if run:
        self.command_accept()


# Traceback (AssertionError)
10:33:50 DEBUG    procs      guiprocess:on_finished:98 Process finished with code 0, status 0.
10:33:50 DEBUG    procs      editor:on_proc_closed:73 Editor closed
10:33:50 DEBUG    procs      editor:on_proc_closed:90 Read back: foo

10:33:50 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/home/florian/proj/qutebrowser/git/qutebrowser/mainwindow/statusbar/command.py", line 179, in callback
self.set_cmd_text(text)
File "/home/florian/proj/qutebrowser/git/qutebrowser/mainwindow/statusbar/command.py", line 86, in set_cmd_text
self.setText(text)
File "/home/florian/proj/qutebrowser/git/qutebrowser/mainwindow/statusbar/command.py", line 212, in setText
"'{}'!".format(text))
AssertionError: setText got called with invalid text 'foo
'!

# Fixed code
def callback(text):
    if not text or text[0] not in modeparsers.STARTCHARS:
        message.error(
            "command must start with one of {}".format(modeparsers.STARTCHARS)
        )
        return
    self.set_cmd_text(text)
    if run:
        self.command_accept()
# Buggy code
def createRequest(self, _op, request, _outgoing_data):
    """Create a new request.

    Args:
         request: const QNetworkRequest & req
         _op: Operation op
         _outgoing_data: QIODevice * outgoingData

    Return:
        A QNetworkReply for directories, None for files.
    """
    path = request.url().toLocalFile()
    if os.path.isdir(path):
        data = dirbrowser_html(path)
        return networkreply.FixedDataNetworkReply(
            request, data, "text/html", self.parent()
        )


# Traceback (UnicodeEncodeError)
10:56:42 DEBUG    init       app:process_pos_args:275 Startup URL file:///tmp/people.inf.elte.hu/mersaai/helpvizsgahoz/cpp%20vizsg%ED%B3%83%ED%B2%A1ra/index.html
[...]
10:56:42 ERROR    misc       utils:wrapper:616 Error in qutebrowser.browser.network.networkmanager.NetworkManager.createRequest
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/qutebrowser/utils/utils.py", line 614, in wrapper
return func(*args, **kwargs)
File "/usr/lib/python3.5/site-packages/qutebrowser/browser/network/networkmanager.py", line 365, in createRequest
op, req, outgoing_data)
File "/usr/lib/python3.5/site-packages/qutebrowser/browser/network/filescheme.py", line 116, in createRequest
if os.path.isdir(path):
File "/usr/lib/python3.5/genericpath.py", line 42, in isdir
st = os.stat(s)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 55-60: ordinal not in range(128)

# Fixed code
def createRequest(self, _op, request, _outgoing_data):
    """Create a new request.

    Args:
         request: const QNetworkRequest & req
         _op: Operation op
         _outgoing_data: QIODevice * outgoingData

    Return:
        A QNetworkReply for directories, None for files.
    """
    path = request.url().toLocalFile()
    try:
        if os.path.isdir(path):
            data = dirbrowser_html(path)
            return networkreply.FixedDataNetworkReply(
                request, data, "text/html", self.parent()
            )
    except UnicodeEncodeError:
        return None
# Buggy code
def tab_close_prompt_if_pinned(self, tab, force, yes_action):
    """Helper method for tab_close.

    If tab is pinned, prompt. If everything is good, run yes_action.
    """
    if tab.data.pinned and not force:
        message.confirm_async(
            title="Pinned Tab",
            text="Are you sure you want to close a pinned tab?",
            yes_action=yes_action,
            default=False,
        )
    else:
        yes_action()


# Traceback (RuntimeError)
09:25:53 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/home/florian/proj/qutebrowser/git/qutebrowser/browser/commands.py", line 219, in _tab_close
tabbar = self._tabbed_browser.tabBar()
RuntimeError: wrapped C/C++ object of type TabbedBrowser has been deleted

# Fixed code
def tab_close_prompt_if_pinned(self, tab, force, yes_action):
    """Helper method for tab_close.

    If tab is pinned, prompt. If not, run yes_action.
    If tab is destroyed, abort question.
    """
    if tab.data.pinned and not force:
        message.confirm_async(
            title="Pinned Tab",
            text="Are you sure you want to close a pinned tab?",
            yes_action=yes_action,
            default=False,
            abort_on=[tab.destroyed],
        )
    else:
        yes_action()