From 9b3ec96062af4c1e0cf6cc4cd31afd49254f7366 Mon Sep 17 00:00:00 2001 From: Cangyuan Li Date: Sun, 12 Nov 2023 23:12:26 -0500 Subject: [PATCH] Check for the __len__ attribute instead of checking if it isn't ArrayLike. This should be more general and satisfy python3.9 --- src/pyethnicity/utils/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyethnicity/utils/utils.py b/src/pyethnicity/utils/utils.py index a94aeee..8a06777 100644 --- a/src/pyethnicity/utils/utils.py +++ b/src/pyethnicity/utils/utils.py @@ -16,7 +16,7 @@ def _assert_equal_lengths(*inputs: Union[object, ArrayLike]): lengths = [] for input in inputs: - if not isinstance(input, ArrayLike) or isinstance(input, str): + if not hasattr(input, "__len__") or isinstance(input, str): input = [input] lengths.append(len(input))