-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: cast numpy integers to integers in ak.from_buffers (fixes #2947) * Add test for 3502225e9246ce0197d6143c9d94c9e1aeec88b8 * style: pre-commit fixes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
904b3a8
commit d5bc304
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward/blob/main/LICENSE | ||
from __future__ import annotations | ||
|
||
import numpy as np | ||
|
||
import awkward as ak | ||
|
||
|
||
def test(): | ||
"""Check that to_list() does not break when the array is built from buffers | ||
with a length of type np.int64. | ||
""" | ||
awk = ak.Array(np.ones((7, 0))) | ||
form, length, container = ak.to_buffers(ak.to_packed(awk)) | ||
awk_from_buf = ak.from_buffers(form, np.int64(length), container) | ||
lst = awk_from_buf.to_list() | ||
|
||
assert len(lst) == length |