Skip to content

Commit

Permalink
Merge from 5.x: PR #10617
Browse files Browse the repository at this point in the history
Fixes #10603
  • Loading branch information
ccordoba12 committed Jul 1, 2022
2 parents 6cf8c92 + f108294 commit 19552ac
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion spyder/plugins/variableexplorer/widgets/collectionsdelegate.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,15 @@ def createEditor(self, parent, option, index, object_explorer=False):
key = index.model().get_key(index)
readonly = (isinstance(value, (tuple, set)) or self.parent().readonly
or not is_known_type(value))

# We can't edit Numpy void objects because they could be anything, so
# this might cause a crash.
# Fixes spyder-ide/spyder#10603
if isinstance(value, np.void):
self.sig_editor_shown.emit()
return None
# CollectionsEditor for a list, tuple, dict, etc.
if isinstance(value, (list, set, tuple, dict)) and not object_explorer:
elif isinstance(value, (list, set, tuple, dict)) and not object_explorer:
from spyder.widgets.collectionseditor import CollectionsEditor
editor = CollectionsEditor(parent=parent)
editor.setup(value, key, icon=self.parent().windowIcon(),
Expand Down Expand Up @@ -201,6 +208,7 @@ def createEditor(self, parent, option, index, object_explorer=False):
from .dataframeeditor import DataFrameEditor
editor = DataFrameEditor(parent=parent)
if not editor.setup_and_check(value, title=key):
self.sig_editor_shown.emit()
return
self.create_dialog(editor, dict(model=index.model(), editor=editor,
key=key, readonly=readonly))
Expand Down

0 comments on commit 19552ac

Please sign in to comment.