From 6244c0631e1a78926db27143bf936bfb5e95c852 Mon Sep 17 00:00:00 2001 From: MilesCranmer Date: Wed, 22 Jun 2022 17:00:38 -0400 Subject: MAINT: Fix edgecase for bool containers --- numpy/lib/arraysetops.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'numpy/lib/arraysetops.py') diff --git a/numpy/lib/arraysetops.py b/numpy/lib/arraysetops.py index e10700785..9a44d7e44 100644 --- a/numpy/lib/arraysetops.py +++ b/numpy/lib/arraysetops.py @@ -623,9 +623,9 @@ def in1d(ar1, ar2, assume_unique=False, invert=False, *, kind=None): ar2 = ar2.reshape(-1, 1) # Convert booleans to uint8 so we can use the fast integer algorithm if ar1.dtype == bool: - ar1 = ar1.view(np.uint8) + ar1 = ar1 + np.uint8(0) if ar2.dtype == bool: - ar2 = ar2.view(np.uint8) + ar2 = ar2 + np.uint8(0) # Check if we can use a fast integer algorithm: integer_arrays = (np.issubdtype(ar1.dtype, np.integer) and -- cgit v1.2.1