Skip to content

Commit

Permalink
Fix bug in Table.__setattr__: don't terminate on cache invalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonlopaciuk committed Dec 10, 2024
1 parent dbca11b commit e3de3d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ def test_table_setitem_col():
assert np.array_equal(t["2betx"], data["betx"] * 2)
t["betx"] = 1
assert np.array_equal(t["betx"], np.ones(len(data["betx"])))
t["name"] = t["name"] * 2
assert np.all(t['name'] == [x * 2 for x in data['name']])


def test_table_setitem_col_row():
Expand Down
3 changes: 2 additions & 1 deletion xdeps/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,8 @@ def __setitem__(self, key, val):
object.__setattr__(self, "_index_cache", None)
object.__setattr__(self, "_count_cache", None)
object.__setattr__(self, "_name_cache", None)
elif isinstance(key, str):

if isinstance(key, str):
if key in self.__dict__:
object.__setattr__(self, key, val)
elif key in self._col_names:
Expand Down

0 comments on commit e3de3d0

Please sign in to comment.