# Buggy code
def set_filename(self, filename):
    """Set filename without performing code analysis."""
    filename = to_text_string(filename)  # filename is a QString instance
    self.kill_if_running()
    index, _data = self.get_data(filename)
    is_parent = self.parent is not None

    if filename not in self.curr_filenames:
        self.filecombo.insertItem(0, filename)
        self.curr_filenames.insert(0, filename)
        self.filecombo.setCurrentIndex(0)
    else:
        index = self.filecombo.findText(filename)
        self.filecombo.removeItem(index)
        self.curr_filenames.pop(index)
        self.filecombo.insertItem(0, filename)
        self.curr_filenames.insert(0, filename)
        self.filecombo.setCurrentIndex(0)

    num_elements = self.filecombo.count()
    if is_parent:
        if num_elements > self.parent.get_option("max_entries"):
            self.filecombo.removeItem(num_elements - 1)
    self.filecombo.selected()


# Traceback (IndexError)
Traceback (most recent call last):
File "C:\Users\uidn7351\AppData\Local\Continuum\anaconda3\Scripts\spyder-script.py", line 10, in
sys.exit(main())
File "C:\Users\uidn7351\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\app\start.py", line 205, in main
mainwindow.main()
File "C:\Users\uidn7351\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3763, in main
mainwindow = run_spyder(app, options, args)
File "C:\Users\uidn7351\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3638, in run_spyder
main.setup()
File "C:\Users\uidn7351\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 984, in setup
plugin = module.PLUGIN_CLASS(self)
File "C:\Users\uidn7351\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\plugins\pylint\plugin.py", line 56, in __init__
self.pylint = PylintWidget(self, max_entries=max_entries,
File "C:\Users\uidn7351\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\plugins\pylint\widgets\pylintgui.py", line 252, in __init__
self.set_filename(f)
File "C:\Users\uidn7351\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\plugins\pylint\widgets\pylintgui.py", line 279, in set_filename
self.curr_filenames.pop(index)
IndexError: pop index out of range

# Fixed code
def set_filename(self, filename):
    """Set filename without performing code analysis."""
    filename = to_text_string(filename)  # filename is a QString instance
    self.kill_if_running()
    index, _data = self.get_data(filename)
    is_parent = self.parent is not None

    if filename not in self.curr_filenames:
        self.filecombo.insertItem(0, filename)
        self.curr_filenames.insert(0, filename)
        self.filecombo.setCurrentIndex(0)
    else:
        try:
            index = self.filecombo.findText(filename)
            self.filecombo.removeItem(index)
            self.curr_filenames.pop(index)
        except IndexError:
            self.curr_filenames.remove(filename)
        self.filecombo.insertItem(0, filename)
        self.curr_filenames.insert(0, filename)
        self.filecombo.setCurrentIndex(0)

    num_elements = self.filecombo.count()
    if is_parent:
        if num_elements > self.parent.get_option("max_entries"):
            self.filecombo.removeItem(num_elements - 1)
    self.filecombo.selected()