Skip to content

Commit a93f4b3

Browse files
committed
Merge remote-tracking branch 'upstream/maint/3.2.x'
2 parents 85c7b37 + 322fa38 commit a93f4b3

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

nibabel/streamlines/array_sequence.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,22 @@ def _define_operators(cls):
6060
def _wrap(cls, op, inplace=False, unary=False):
6161

6262
def fn_unary_op(self):
63-
return self._op(op)
63+
try:
64+
return self._op(op)
65+
except SystemError as e:
66+
message = ("Numpy returned an uninformative error. It possibly should be "
67+
"'Integers to negative integer powers are not allowed.' "
68+
"See https://github.com/numpy/numpy/issues/19634 for details.")
69+
raise ValueError(message) from e
6470

6571
def fn_binary_op(self, value):
66-
return self._op(op, value, inplace=inplace)
72+
try:
73+
return self._op(op, value, inplace=inplace)
74+
except SystemError as e:
75+
message = ("Numpy returned an uninformative error. It possibly should be "
76+
"'Integers to negative integer powers are not allowed.' "
77+
"See https://github.com/numpy/numpy/issues/19634 for details.")
78+
raise ValueError(message) from e
6779

6880
setattr(cls, op, fn_unary_op if unary else fn_binary_op)
6981
fn = getattr(cls, op)

0 commit comments

Comments
 (0)