Skip to content

Commit

Permalink
Specify unsafe casting when clipping to fix error on numpy 1.25
Browse files Browse the repository at this point in the history
  • Loading branch information
aganders3 committed Jun 21, 2023
1 parent d58014a commit 8bbccc1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion vispy/gloo/texture.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ def convert_dtype_and_clip(data, dtype, copy=False):
else:
# to reduce copying, we clip into a pre-generated array of the right dtype
new_data = np.empty_like(data, dtype=dtype)
np.clip(data, new_min, new_max, out=new_data)
# allow "unsafe" casting here as we're explicitly clipping to the
# range of the new dtype - this was a default before numpy 1.25
np.clip(data, new_min, new_max, out=new_data, casting="unsafe")
return new_data


Expand Down

0 comments on commit 8bbccc1

Please sign in to comment.