Skip to content

Commit 6a6b2c4

Browse files
committed
BUG: Raise TypeError for mismatched signed/unsigned dtypes
1 parent 2261af1 commit 6a6b2c4

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

pandas/core/arrays/interval.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -263,19 +263,6 @@ def __new__(
263263
dtype=dtype,
264264
)
265265

266-
# Check for mismatched signed/unsigned integer dtypes after casting
267-
left_dtype = left.dtype
268-
right_dtype = right.dtype
269-
if (
270-
left_dtype.kind in "iu"
271-
and right_dtype.kind in "iu"
272-
and left_dtype.kind != right_dtype.kind
273-
):
274-
raise TypeError(
275-
f"Left and right arrays must have matching signedness. "
276-
f"Got {left_dtype} and {right_dtype}."
277-
)
278-
279266
if verify_integrity:
280267
cls._validate(left, right, dtype=dtype)
281268

@@ -394,6 +381,18 @@ def _ensure_simple_new_inputs(
394381

395382
dtype = IntervalDtype(left.dtype, closed=closed)
396383

384+
# Check for mismatched signed/unsigned integer dtypes after casting
385+
left_dtype = left.dtype
386+
right_dtype = right.dtype
387+
if (
388+
left_dtype.kind in "iu"
389+
and right_dtype.kind in "iu"
390+
and left_dtype.kind != right_dtype.kind
391+
):
392+
raise TypeError(
393+
f"Left and right arrays must have matching signedness. "
394+
f"Got {left_dtype} and {right_dtype}."
395+
)
397396
return left, right, dtype
398397

399398
@classmethod

0 commit comments

Comments
 (0)