# Buggy code
def load_from_conf(self):
    """Load settings from configuration file"""
    for checkbox, (option, default) in list(self.checkboxes.items()):
        checkbox.setChecked(self.get_option(option, default))
        # QAbstractButton works differently for PySide and PyQt
        checkbox.clicked.connect(lambda opt=option: self.has_been_modified(opt))
    for radiobutton, (option, default) in list(self.radiobuttons.items()):
        radiobutton.setChecked(self.get_option(option, default))
        radiobutton.toggled.connect(
            lambda _foo, opt=option: self.has_been_modified(opt)
        )
        if radiobutton.restart_required:
            self.restart_options[option] = radiobutton.label_text
    for lineedit, (option, default) in list(self.lineedits.items()):
        data = self.get_option(option, default)
        if getattr(lineedit, "content_type", None) == list:
            data = ", ".join(data)
        lineedit.setText(data)
        lineedit.textChanged.connect(
            lambda _foo, opt=option: self.has_been_modified(opt)
        )
        if lineedit.restart_required:
            self.restart_options[option] = lineedit.label_text
    for textedit, (option, default) in list(self.textedits.items()):
        data = self.get_option(option, default)
        if getattr(textedit, "content_type", None) == list:
            data = ", ".join(data)
        elif getattr(textedit, "content_type", None) == dict:
            data = to_text_string(data)
        textedit.setPlainText(data)
        textedit.textChanged.connect(lambda opt=option: self.has_been_modified(opt))
        if textedit.restart_required:
            self.restart_options[option] = textedit.label_text
    for spinbox, (option, default) in list(self.spinboxes.items()):
        spinbox.setValue(self.get_option(option, default))
        spinbox.valueChanged.connect(
            lambda _foo, opt=option: self.has_been_modified(opt)
        )
    for combobox, (option, default) in list(self.comboboxes.items()):
        value = self.get_option(option, default)
        for index in range(combobox.count()):
            data = from_qvariant(combobox.itemData(index), to_text_string)
            # For PyQt API v2, it is necessary to convert `data` to
            # unicode in case the original type was not a string, like an
            # integer for example (see qtpy.compat.from_qvariant):
            if to_text_string(data) == to_text_string(value):
                break
        else:
            if combobox.count() == 0:
                index = None
        if index:
            combobox.setCurrentIndex(index)
        combobox.currentIndexChanged.connect(
            lambda _foo, opt=option: self.has_been_modified(opt)
        )
        if combobox.restart_required:
            self.restart_options[option] = combobox.label_text

    for (fontbox, sizebox), option in list(self.fontboxes.items()):
        font = self.get_font(option)
        fontbox.setCurrentFont(font)
        sizebox.setValue(font.pointSize())
        if option is None:
            property = "plugin_font"
        else:
            property = option
        fontbox.currentIndexChanged.connect(
            lambda _foo, opt=property: self.has_been_modified(opt)
        )
        sizebox.valueChanged.connect(
            lambda _foo, opt=property: self.has_been_modified(opt)
        )
    for clayout, (option, default) in list(self.coloredits.items()):
        property = to_qvariant(option)
        edit = clayout.lineedit
        btn = clayout.colorbtn
        edit.setText(self.get_option(option, default))
        # QAbstractButton works differently for PySide and PyQt
        if not API == "pyside":
            btn.clicked.connect(lambda _foo, opt=option: self.has_been_modified(opt))
        else:
            btn.clicked.connect(lambda opt=option: self.has_been_modified(opt))
        edit.textChanged.connect(lambda _foo, opt=option: self.has_been_modified(opt))
    for (clayout, cb_bold, cb_italic), (option, default) in list(self.scedits.items()):
        edit = clayout.lineedit
        btn = clayout.colorbtn
        color, bold, italic = self.get_option(option, default)
        edit.setText(color)
        cb_bold.setChecked(bold)
        cb_italic.setChecked(italic)
        edit.textChanged.connect(lambda _foo, opt=option: self.has_been_modified(opt))
        # QAbstractButton works differently for PySide and PyQt
        if not API == "pyside":
            btn.clicked.connect(lambda _foo, opt=option: self.has_been_modified(opt))
            cb_bold.clicked.connect(
                lambda _foo, opt=option: self.has_been_modified(opt)
            )
            cb_italic.clicked.connect(
                lambda _foo, opt=option: self.has_been_modified(opt)
            )
        else:
            btn.clicked.connect(lambda opt=option: self.has_been_modified(opt))
            cb_bold.clicked.connect(lambda opt=option: self.has_been_modified(opt))
            cb_italic.clicked.connect(lambda opt=option: self.has_been_modified(opt))


# Traceback (AttributeError)
File "/usr/lib/python3.7/site-packages/spyder/preferences/configdialog.py", line 222, in button_clicked
configpage.apply_changes()
File "/usr/lib/python3.7/site-packages/spyder/preferences/configdialog.py", line 96, in apply_changes
self.save_to_conf()
File "/usr/lib/python3.7/site-packages/spyder/preferences/configdialog.py", line 425, in save_to_conf
if lineedit.content_type == list:
AttributeError: 'QLineEdit' object has no attribute 'content_type'

# Fixed code
def load_from_conf(self):
    """Load settings from configuration file"""
    for checkbox, (option, default) in list(self.checkboxes.items()):
        checkbox.setChecked(self.get_option(option, default))
        # QAbstractButton works differently for PySide and PyQt
        checkbox.clicked.connect(lambda opt=option: self.has_been_modified(opt))
    for radiobutton, (option, default) in list(self.radiobuttons.items()):
        radiobutton.setChecked(self.get_option(option, default))
        radiobutton.toggled.connect(
            lambda _foo, opt=option: self.has_been_modified(opt)
        )
        if radiobutton.restart_required:
            self.restart_options[option] = radiobutton.label_text
    for lineedit, (option, default) in list(self.lineedits.items()):
        data = self.get_option(option, default)
        if getattr(lineedit, "content_type", None) == list:
            data = ", ".join(data)
        lineedit.setText(data)
        lineedit.textChanged.connect(
            lambda _foo, opt=option: self.has_been_modified(opt)
        )
        if lineedit.restart_required:
            self.restart_options[option] = lineedit.label_text
    for textedit, (option, default) in list(self.textedits.items()):
        data = self.get_option(option, default)
        if getattr(textedit, "content_type", None) == list:
            data = ", ".join(data)
        elif getattr(textedit, "content_type", None) == dict:
            data = to_text_string(data)
        textedit.setPlainText(data)
        textedit.textChanged.connect(lambda opt=option: self.has_been_modified(opt))
        if textedit.restart_required:
            self.restart_options[option] = textedit.label_text
    for spinbox, (option, default) in list(self.spinboxes.items()):
        spinbox.setValue(self.get_option(option, default))
        spinbox.valueChanged.connect(
            lambda _foo, opt=option: self.has_been_modified(opt)
        )
    for combobox, (option, default) in list(self.comboboxes.items()):
        value = self.get_option(option, default)
        for index in range(combobox.count()):
            data = from_qvariant(combobox.itemData(index), to_text_string)
            # For PyQt API v2, it is necessary to convert `data` to
            # unicode in case the original type was not a string, like an
            # integer for example (see qtpy.compat.from_qvariant):
            if to_text_string(data) == to_text_string(value):
                break
        else:
            if combobox.count() == 0:
                index = None
        if index:
            combobox.setCurrentIndex(index)
        combobox.currentIndexChanged.connect(
            lambda _foo, opt=option: self.has_been_modified(opt)
        )
        if combobox.restart_required:
            self.restart_options[option] = combobox.label_text

    for (fontbox, sizebox), option in list(self.fontboxes.items()):
        font = self.get_font(option)
        fontbox.setCurrentFont(font)
        sizebox.setValue(font.pointSize())
        if option is None:
            property = "plugin_font"
        else:
            property = option
        fontbox.currentIndexChanged.connect(
            lambda _foo, opt=property: self.has_been_modified(opt)
        )
        sizebox.valueChanged.connect(
            lambda _foo, opt=property: self.has_been_modified(opt)
        )
    for clayout, (option, default) in list(self.coloredits.items()):
        property = to_qvariant(option)
        edit = clayout.lineedit
        btn = clayout.colorbtn
        edit.setText(self.get_option(option, default))
        # QAbstractButton works differently for PySide and PyQt
        if not API == "pyside":
            btn.clicked.connect(lambda _foo, opt=option: self.has_been_modified(opt))
        else:
            btn.clicked.connect(lambda opt=option: self.has_been_modified(opt))
        edit.textChanged.connect(lambda _foo, opt=option: self.has_been_modified(opt))
    for (clayout, cb_bold, cb_italic), (option, default) in list(self.scedits.items()):
        edit = clayout.lineedit
        btn = clayout.colorbtn
        options = self.get_option(option, default)
        if options:
            color, bold, italic = options
            edit.setText(color)
            cb_bold.setChecked(bold)
            cb_italic.setChecked(italic)

        edit.textChanged.connect(lambda _foo, opt=option: self.has_been_modified(opt))
        # QAbstractButton works differently for PySide and PyQt
        if not API == "pyside":
            btn.clicked.connect(lambda _foo, opt=option: self.has_been_modified(opt))
            cb_bold.clicked.connect(
                lambda _foo, opt=option: self.has_been_modified(opt)
            )
            cb_italic.clicked.connect(
                lambda _foo, opt=option: self.has_been_modified(opt)
            )
        else:
            btn.clicked.connect(lambda opt=option: self.has_been_modified(opt))
            cb_bold.clicked.connect(lambda opt=option: self.has_been_modified(opt))
            cb_italic.clicked.connect(lambda opt=option: self.has_been_modified(opt))