Skip to content

Commit

Permalink
fix: allow known-buffers in unknown-length contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 committed Oct 3, 2023
1 parent 1a97003 commit bf5c157
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/awkward/operations/ak_from_buffers.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,8 @@ def _from_buffer(
# for the parent of this node. Thus, this node and its children *must* only
# contain placeholders
if count is unknown_length:
# Only placeholders can have unknown lengths
if not isinstance(buffer, PlaceholderArray):
raise AssertionError("Encountered unknown length for concrete buffer")
# We may actually have a known buffer here, but as we do not know the length,
# we cannot safely trim it. Thus, introduce a placeholder anyway
return PlaceholderArray(nplike, (unknown_length,), dtype)
# Known-length information implies that we should have known-length buffers here
# We could choose to make this an error, and have the caller re-implement some
Expand Down

0 comments on commit bf5c157

Please sign in to comment.