From 6769ea44a7c5f3dcf4985b601dcdcdce64b96b26 Mon Sep 17 00:00:00 2001 From: quantresearch1 <107650207+quantresearch1@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:51:48 -0500 Subject: [PATCH 1/2] Fix issue #2025 Numpy versions prior to 1.22.0 will raise >>> ndarray_object_type = np.ndarray[Any, np.dtype[np.object_]] Traceback (most recent call last): File "", line 1, in TypeError: 'numpy._DTypeMeta' object is not subscriptable --- src/highspy/highs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/highspy/highs.py b/src/highspy/highs.py index 80255b15d6..bc04ce8d77 100644 --- a/src/highspy/highs.py +++ b/src/highspy/highs.py @@ -17,7 +17,8 @@ ) # backwards typing support information for HighspyArray -if sys.version_info >= (3, 9): +np_version = tuple(map(int, np.__version__.split('.'))) +if sys.version_info >= (3, 9) and np_version >= (1.22.0): ndarray_object_type = np.ndarray[Any, np.dtype[np.object_]] else: ndarray_object_type = np.ndarray From e574144b67747287ca5e3bce3f3983967dff2d30 Mon Sep 17 00:00:00 2001 From: quantresearch1 <107650207+quantresearch1@users.noreply.github.com> Date: Tue, 3 Dec 2024 19:57:53 +0000 Subject: [PATCH 2/2] fix-2025 --- src/highspy/highs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/highspy/highs.py b/src/highspy/highs.py index bc04ce8d77..af42594be9 100644 --- a/src/highspy/highs.py +++ b/src/highspy/highs.py @@ -18,7 +18,7 @@ # backwards typing support information for HighspyArray np_version = tuple(map(int, np.__version__.split('.'))) -if sys.version_info >= (3, 9) and np_version >= (1.22.0): +if sys.version_info >= (3, 9) and np_version >= (1,22,0): ndarray_object_type = np.ndarray[Any, np.dtype[np.object_]] else: ndarray_object_type = np.ndarray