Skip to content

Commit

Permalink
fix: resulting __setitem__ layout type for ak.Record (#3372)
Browse files Browse the repository at this point in the history
* fix resulting __setitem__ layout type for ak.Record

* add test

---------

Co-authored-by: Ianna Osborne <[email protected]>
  • Loading branch information
pfackeldey and ianna authored Jan 16, 2025
1 parent e5b6608 commit 6c01d57
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/awkward/highlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2144,8 +2144,8 @@ def __setitem__(self, where, what):
):
raise TypeError("only fields may be assigned in-place (by field name)")

self._layout = ak.operations.ak_with_field._impl(
self._layout,
self._layout._array = ak.operations.ak_with_field._impl(
self._layout.array,
what,
where,
highlevel=False,
Expand Down
14 changes: 14 additions & 0 deletions tests/test_3372_akRecord_setitem.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward/blob/main/LICENSE
# ruff: noqa: E402

from __future__ import annotations

import awkward as ak


def test():
rec = ak.Record({"a": 1})
assert isinstance(rec.layout, ak.record.Record)

rec["b"] = 2
assert isinstance(rec.layout, ak.record.Record)

0 comments on commit 6c01d57

Please sign in to comment.