Skip to content

Commit e6aad17

Browse files
fix corner cases for calling pandas_dtype
1 parent db8900c commit e6aad17

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pandas/core/dtypes/common.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,8 +1451,12 @@ def is_extension_array_dtype(arr_or_dtype) -> bool:
14511451
return False
14521452
else:
14531453
try:
1454-
dtype = pandas_dtype(dtype)
1455-
except TypeError:
1454+
with warnings.catch_warnings():
1455+
# pandas_dtype(..) can raise UserWarning for class input
1456+
warnings.simplefilter("ignore", UserWarning)
1457+
dtype = pandas_dtype(dtype)
1458+
except (TypeError, ValueError):
1459+
# np.dtype(..) can raise ValueError
14561460
return False
14571461
return isinstance(dtype, ExtensionDtype)
14581462

0 commit comments

Comments
 (0)