# Buggy code
def __init__(
    self,
    parent=None,
    namespace=None,
    commands=[],
    message=None,
    max_line_count=300,
    font=None,
    exitfunc=None,
    profile=False,
    multithreaded=True,
):
    PythonShellWidget.__init__(
        self, parent, get_conf_path("history_internal.py"), profile=profile
    )

    self.multithreaded = multithreaded
    self.setMaximumBlockCount(max_line_count)

    if font is not None:
        self.set_font(font)

    # Allow raw_input support:
    self.input_loop = None
    self.input_mode = False

    # KeyboardInterrupt support
    self.interrupted = False  # used only for not-multithreaded mode
    self.sig_keyboard_interrupt.connect(self.keyboard_interrupt)

    # Code completion / calltips
    getcfg = lambda option: CONF.get("internal_console", option)
    case_sensitive = getcfg("codecompletion/case_sensitive")
    self.set_codecompletion_case(case_sensitive)

    # keyboard events management
    self.eventqueue = []

    # Init interpreter
    self.exitfunc = exitfunc
    self.commands = commands
    self.message = message
    self.interpreter = None
    self.start_interpreter(namespace)

    # Clear status bar
    self.status.emit("")

    # Embedded shell -- requires the monitor (which installs the
    # 'open_in_spyder' function in builtins)
    if hasattr(builtins, "open_in_spyder"):
        self.go_to_error.connect(self.open_with_external_spyder)


# Traceback (AttributeError)
File "C:\Users\C. A. M. Gerlach\Documents\dev\SpyderDev\spyder\spyder\plugins\editor\lsp\client.py", line 230, in on_msg_received
handler(resp['result'], req_id)
File "C:\Users\C. A. M. Gerlach\Documents\dev\SpyderDev\spyder\spyder\plugins\editor\lsp\providers\document.py", line 117, in process_document_completion
LSPRequestTypes.DOCUMENT_COMPLETION, {'params': response})
File "C:\Users\C. A. M. Gerlach\Documents\dev\SpyderDev\spyder\spyder\plugins\editor\widgets\codeeditor.py", line 690, in handle_response
handler(params)
File "C:\Users\C. A. M. Gerlach\Documents\dev\SpyderDev\spyder\spyder\plugins\editor\widgets\codeeditor.py", line 790, in process_completion
self.completion_widget.show_list(completion_list, position)
File "C:\Users\C. A. M. Gerlach\Documents\dev\SpyderDev\spyder\spyder\plugins\editor\widgets\base.py", line 159, in show_list
self.update_current()
File "C:\Users\C. A. M. Gerlach\Documents\dev\SpyderDev\spyder\spyder\plugins\editor\widgets\base.py", line 222, in update_current
completion_label = completion.lower()
AttributeError: 'dict' object has no attribute 'lower'

# Fixed code
def __init__(
    self,
    parent=None,
    namespace=None,
    commands=[],
    message=None,
    max_line_count=300,
    font=None,
    exitfunc=None,
    profile=False,
    multithreaded=True,
):
    PythonShellWidget.__init__(
        self, parent, get_conf_path("history_internal.py"), profile=profile
    )

    self.multithreaded = multithreaded
    self.setMaximumBlockCount(max_line_count)

    if font is not None:
        self.set_font(font)

    # Allow raw_input support:
    self.input_loop = None
    self.input_mode = False

    # KeyboardInterrupt support
    self.interrupted = False  # used only for not-multithreaded mode
    self.sig_keyboard_interrupt.connect(self.keyboard_interrupt)

    # Code completion / calltips
    getcfg = lambda option: CONF.get("internal_console", option)

    # keyboard events management
    self.eventqueue = []

    # Init interpreter
    self.exitfunc = exitfunc
    self.commands = commands
    self.message = message
    self.interpreter = None
    self.start_interpreter(namespace)

    # Clear status bar
    self.status.emit("")

    # Embedded shell -- requires the monitor (which installs the
    # 'open_in_spyder' function in builtins)
    if hasattr(builtins, "open_in_spyder"):
        self.go_to_error.connect(self.open_with_external_spyder)