# Buggy code
def is_completion_widget_visible(self):
    """Return True is completion list widget is visible"""
    return self.completion_widget.isVisible()


# Traceback (RuntimeError)
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 4208, in mouseMoveEvent
and not self.is_completion_widget_visible()):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\base.py", line 927, in is_completion_widget_visible
return self.completion_widget.isVisible()
RuntimeError: wrapped C/C++ object of type CompletionWidget has been deleted
Traceback (most recent call last):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 663, in _handle_hover
elif not self.is_completion_widget_visible():
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\base.py", line 927, in is_completion_widget_visible
return self.completion_widget.isVisible()
RuntimeError: wrapped C/C++ object of type CompletionWidget has been deleted
Traceback (most recent call last):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 4208, in mouseMoveEvent
and not self.is_completion_widget_visible()):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\base.py", line 927, in is_completion_widget_visible
return self.completion_widget.isVisible()
RuntimeError: wrapped C/C++ object of type CompletionWidget has been deleted
Traceback (most recent call last):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 4208, in mouseMoveEvent
and not self.is_completion_widget_visible()):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\base.py", line 927, in is_completion_widget_visible
return self.completion_widget.isVisible()
RuntimeError: wrapped C/C++ object of type CompletionWidget has been deleted
Traceback (most recent call last):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 4208, in mouseMoveEvent
and not self.is_completion_widget_visible()):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\base.py", line 927, in is_completion_widget_visible
return self.completion_widget.isVisible()
RuntimeError: wrapped C/C++ object of type CompletionWidget has been deleted
Traceback (most recent call last):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 4208, in mouseMoveEvent
and not self.is_completion_widget_visible()):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\base.py", line 927, in is_completion_widget_visible
return self.completion_widget.isVisible()
RuntimeError: wrapped C/C++ object of type CompletionWidget has been deleted
Traceback (most recent call last):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 4208, in mouseMoveEvent
and not self.is_completion_widget_visible()):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\base.py", line 927, in is_completion_widget_visible
return self.completion_widget.isVisible()
RuntimeError: wrapped C/C++ object of type CompletionWidget has been deleted
Traceback (most recent call last):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 4208, in mouseMoveEvent
and not self.is_completion_widget_visible()):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\base.py", line 927, in is_completion_widget_visible
return self.completion_widget.isVisible()
RuntimeError: wrapped C/C++ object of type CompletionWidget has been deleted
Traceback (most recent call last):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 4208, in mouseMoveEvent
and not self.is_completion_widget_visible()):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\base.py", line 927, in is_completion_widget_visible
return self.completion_widget.isVisible()
RuntimeError: wrapped C/C++ object of type CompletionWidget has been deleted
Traceback (most recent call last):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 4208, in mouseMoveEvent
and not self.is_completion_widget_visible()):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\base.py", line 927, in is_completion_widget_visible
return self.completion_widget.isVisible()
RuntimeError: wrapped C/C++ object of type CompletionWidget has been deleted
Traceback (most recent call last):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 4208, in mouseMoveEvent
and not self.is_completion_widget_visible()):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\base.py", line 927, in is_completion_widget_visible
return self.completion_widget.isVisible()
RuntimeError: wrapped C/C++ object of type CompletionWidget has been deleted
Traceback (most recent call last):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 4208, in mouseMoveEvent
and not self.is_completion_widget_visible()):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\base.py", line 927, in is_completion_widget_visible
return self.completion_widget.isVisible()
RuntimeError: wrapped C/C++ object of type CompletionWidget has been deleted
Traceback (most recent call last):
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 663, in _handle_hover
elif not self.is_completion_widget_visible():
File "C:\Users\racha\anaconda3\lib\site-packages\spyder\plugins\editor\widgets\base.py", line 927, in is_completion_widget_visible
return self.completion_widget.isVisible()
RuntimeError: wrapped C/C++ object of type CompletionWidget has been deleted

# Fixed code
def is_completion_widget_visible(self):
    """Return True is completion list widget is visible"""
    try:
        return self.completion_widget.isVisible()
    except RuntimeError:
        # This is to avoid a RuntimeError exception when the widget is
        # already been deleted. See spyder-ide/spyder#13248.
        return False