Skip to content

Commit

Permalink
fix: support NumPy 2.2
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Aug 9, 2024
1 parent c64e765 commit 8ec2788
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ jobs:

- uses: yezz123/setup-uv@v4

- uses: actions/setup-python@v4
if: matrix.os == 'macos-14'
with:
python-version: 3.8

- uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.build }}
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ test-command = "pytest --benchmark-disable {project}/tests"
test-skip = [
"pp310-*",
"*universal2:arm64",
"cp38-macosx_arm64",
"cp*-*musllinux*", # segfault
]
skip = [
Expand Down
6 changes: 4 additions & 2 deletions src/boost_histogram/_internal/hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,10 @@ def view(
"""
return _to_view(self._hist.view(flow))

def __array__(self) -> np.typing.NDArray[Any]:
return self.view(False)
def __array__(
self, dtype: np.typing.DTypeLike | None = None, *, copy: bool | None = None

Check warning on line 358 in src/boost_histogram/_internal/hist.py

View workflow job for this annotation

GitHub Actions / PyLint

W0621

Redefining name 'copy' from outer scope (line 4)
) -> np.typing.NDArray[Any]:
return np.asarray(self.view(False), dtype=dtype, copy=copy) # type: ignore[no-any-return,call-overload]

def __eq__(self, other: Any) -> bool:
return hasattr(other, "_hist") and self._hist == other._hist
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pandaslike.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class Seriesish:
def __init__(self, array):
self.array = np.asarray(array)

def __array__(self):
return self.array
def __array__(self, dtype=None, *, copy=None):
return np.asarray(self.array, dtype=dtype, copy=copy)


def test_setting_weighted_profile_convertable():
Expand Down

0 comments on commit 8ec2788

Please sign in to comment.