[FIX] Table.add_column - Do not try to insert data in locked empty array#6743
[FIX] Table.add_column - Do not try to insert data in locked empty array#6743janezd merged 1 commit intobiolab:masterfrom
Conversation
|
Here is the PR that introduced skipping locking for empty tables #5714 |
|
But it seems that @markotoplak also fixed unlocking for |
If I understand correctly, @markotoplak's fix just skips unlocking the table in this case (here: https://github.com/markotoplak/orange3/blob/cd5d384da7a34a2f0f57de0eccee2a2ca83d4de6/Orange/data/table.py#L508-L510). That is the part of the comment from his PR:
On my computer (when setting |
|
You're right, I forgot to enable
# Zero-sized arrays cannot be made writeable, yet the below
# assignment would fail despite doing nothing.
if len(self) > 0:
self._get_column_view(index)[:] = data
else:
assert len(self) == len(data)or Even if we change |
835e64f to
f8b4fa2
Compare
|
I agree it can be moved there, and checking the size is also a good idea. Initially, I put it in |
|
... because unlocking is not a problem, so let us not skip it. Unlocking does not raise an error (it just fails to do anything); setting the data does. |
Issue
When a table has no rows add_column still tries to insert (empty) data to the table's array. In case the table's array is empty Orange doesn't unlock it and so inserting fails.
Description of changes
Skip inserting empty data when the array is empty
Includes