From 7cdc582c13cce2cd78391b2218934c26cbe0d83d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Sat, 4 May 2024 11:09:58 +0200 Subject: [PATCH] Remove redundant/deprecated `np.float_` use to fix NumPy 2.0 compat Remove the explicit use of `np.float_` type that is an alias to `np.float64` and that has been removed in NumPy 2.0. This fixes a hard error when running on this version on NumPy, while preserving compatibility with NumPy 1. Fixes #2550 --- elasticsearch/serializer.py | 1 - test_elasticsearch/test_serializer.py | 1 - 2 files changed, 2 deletions(-) diff --git a/elasticsearch/serializer.py b/elasticsearch/serializer.py index 902fe8e09..37ad5724c 100644 --- a/elasticsearch/serializer.py +++ b/elasticsearch/serializer.py @@ -171,7 +171,6 @@ def _attempt_serialize_numpy(data: Any) -> Tuple[bool, Any]: elif isinstance( data, ( - np.float_, np.float16, np.float32, np.float64, diff --git a/test_elasticsearch/test_serializer.py b/test_elasticsearch/test_serializer.py index 9dc5f31e9..4f66ba9a2 100644 --- a/test_elasticsearch/test_serializer.py +++ b/test_elasticsearch/test_serializer.py @@ -89,7 +89,6 @@ def test_serializes_numpy_integers(json_serializer): @requires_numpy_and_pandas def test_serializes_numpy_floats(json_serializer): for np_type in ( - np.float_, np.float32, np.float64, ):