Skip to content

Commit 38c046b

Browse files
authored
fix: graalpy issue with pattern matching (#1078)
* fix: graalpy issue with pattern matching Signed-off-by: Henry Schreiner <henryfs@princeton.edu> * ci: correct the name of graalpy Signed-off-by: Henry Schreiner <henryfs@princeton.edu> --------- Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
1 parent 8619c63 commit 38c046b

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ jobs:
119119
only: cp312-macosx_arm64
120120
- os: windows-11-arm
121121
only: cp311-win_arm64
122+
- os: ubuntu-latest
123+
only: gp311_242-manylinux_x86_64
122124

123125
steps:
124126
- uses: actions/checkout@v6

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ classifiers = [
5151
"Typing :: Typed",
5252
]
5353
dependencies = [
54-
"numpy",
54+
"numpy>=1.21.3",
5555
]
5656

5757
[project.urls]
@@ -76,7 +76,7 @@ docs = [
7676
"ipython",
7777
"myst_parser>=0.13",
7878
"nbsphinx",
79-
"numpy",
79+
"numpy>=1.21.3",
8080
"sphinx-book-theme>=0.0.33",
8181
"sphinx>=4.0",
8282
"sphinx_copybutton",
@@ -94,7 +94,7 @@ test = [
9494
"pytest-benchmark",
9595
"pytest>=6.0",
9696
"pytest-benchmark",
97-
"numpy",
97+
"numpy>=1.21.3",
9898
"hypothesis>=6.0; sys_platform != 'ios'", # slow on iOS, can fail health check
9999
"pytest-xdist; sys_platform != 'ios'", # No processes on iOS
100100
]

src/boost_histogram/histogram.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,15 @@ def _handle_slice(
10871087

10881088
merge = 1
10891089
match step:
1090+
case x if x is sum: # https://github.com/oracle/graalpython/issues/620
1091+
integrations.add(i)
1092+
if start is not None or stop is not None:
1093+
slices.append(
1094+
_core.algorithm.slice(
1095+
i, start_int, stop_int, _core.algorithm.slice_mode.crop
1096+
)
1097+
)
1098+
return reduced, slices, integrations
10901099
case None:
10911100
pass
10921101
case object(factor=x) if x is not None:
@@ -1096,19 +1105,7 @@ def _handle_slice(
10961105
case object(group_mapping=x) if (tmp_groups := x(self.axes[i])) is not None:
10971106
groups = tmp_groups
10981107
case x if callable(x):
1099-
if x is sum:
1100-
integrations.add(i)
1101-
else:
1102-
raise NotImplementedError
1103-
1104-
if start is not None or stop is not None:
1105-
slices.append(
1106-
_core.algorithm.slice(
1107-
i, start_int, stop_int, _core.algorithm.slice_mode.crop
1108-
)
1109-
)
1110-
if len(groups) == 0:
1111-
return reduced, slices, integrations
1108+
raise NotImplementedError
11121109
case _:
11131110
msg = "The third argument to a slice must be rebin or projection"
11141111
raise IndexError(msg)

0 commit comments

Comments
 (0)