Subject: [PATCH v2 07/14] gnu: python-optree: Update to 0.14.0.

From: David Elsing <[email-masked]>
Date: Wed, 22 Jan 2025 18:32:18 +0000

* gnu/packages/python-xyz.scm (python-optree): Update to 0.14.0.
[source]: Remove patch.
[arguments]<#:test-flags>: Disable additional failing test.
[native-inputs]: Replace pybind11 with pybind11-2.13 and cmake with
cmake-minimal.
* gnu/packages/patches/python-optree-fix-32-bit.patch: Remove file.
* gnu/local.mk (dist_patch_DATA): Remove it.
---
 gnu/local.mk                                  |   3 +-
 .../patches/python-optree-fix-32-bit.patch    | 122 ------------------
 gnu/packages/python-xyz.scm                   |  14 +-
 3 files changed, 8 insertions(+), 131 deletions(-)
 delete mode 100644 gnu/packages/patches/python-optree-fix-32-bit.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 5091f93eb8..09a72d2418 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -64,7 +64,7 @@
 # Copyright © 2023, 2024 gemmaro <[email-masked]>
 # Copyright © 2023 Herman Rimm <[email-masked]>
 # Copyright © 2023 Troy Figiel <[email-masked]>
-# Copyright © 2024 David Elsing <[email-masked]>
+# Copyright © 2024, 2025 David Elsing <[email-masked]>
 # Copyright © 2024 Ashish SHUKLA <[email-masked]>
 # Copyright © 2024 Fabio Natali <[email-masked]>
 # Copyright © 2024 Noé Lopez <[email-masked]>
@@ -2095,7 +2095,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-fixtures-remove-monkeypatch-test.patch	\
   %D%/packages/patches/python-hiredis-use-system-hiredis.patch	\
   %D%/packages/patches/python-online-judge-api-client-tests.patch \
-  %D%/packages/patches/python-optree-fix-32-bit.patch		\
   %D%/packages/patches/python-pdoc3-tests.patch			\
   %D%/packages/patches/python-peachpy-determinism.patch	\
   %D%/packages/patches/python-pep8-stdlib-tokenize-compat.patch \
diff --git a/gnu/packages/patches/python-optree-fix-32-bit.patch b/gnu/packages/patches/python-optree-fix-32-bit.patch
deleted file mode 100644
index 6a32c39bd8..0000000000
--- a/gnu/packages/patches/python-optree-fix-32-bit.patch
+++ /dev/null
@@ -1,122 +0,0 @@
-In include/utils.h, ssize_t is an alias for py::ssize_t, which is an alias for
-Py_ssize_t in Python, which is an alias for the system ssize_t.
-The latter is defined in glibc as int if __WORDSIZE == 32 and as long int if
-__WORDSIZE == 64.  Therefore, we need to remove the explicit template
-specialization for int in the first case.
-
-diff --git a/include/utils.h b/include/utils.h
-index 950a02b..82a9591 100644
---- a/include/utils.h
-+++ b/include/utils.h
-@@ -141,10 +141,12 @@ template <>
- inline py::handle GET_ITEM_HANDLE<py::tuple>(const py::handle& container, const size_t& item) {
-     return PyTuple_GET_ITEM(container.ptr(), py::ssize_t_cast(item));
- }
-+#if __WORDSIZE != 32
- template <>
- inline py::handle GET_ITEM_HANDLE<py::tuple>(const py::handle& container, const int& item) {
-     return PyTuple_GET_ITEM(container.ptr(), py::ssize_t_cast(item));
- }
-+#endif
- template <>
- inline py::handle GET_ITEM_HANDLE<py::list>(const py::handle& container, const ssize_t& item) {
-     return PyList_GET_ITEM(container.ptr(), item);
-@@ -153,10 +155,12 @@ template <>
- inline py::handle GET_ITEM_HANDLE<py::list>(const py::handle& container, const size_t& item) {
-     return PyList_GET_ITEM(container.ptr(), py::ssize_t_cast(item));
- }
-+#if __WORDSIZE != 32
- template <>
- inline py::handle GET_ITEM_HANDLE<py::list>(const py::handle& container, const int& item) {
-     return PyList_GET_ITEM(container.ptr(), py::ssize_t_cast(item));
- }
-+#endif
- 
- template <typename Container, typename Item>
- inline py::object GET_ITEM_BORROW(const py::handle& container, const Item& item) {
-@@ -171,11 +175,13 @@ inline py::object GET_ITEM_BORROW<py::tuple>(const py::handle& container, const
-     return py::reinterpret_borrow<py::object>(
-         PyTuple_GET_ITEM(container.ptr(), py::ssize_t_cast(item)));
- }
-+#if __WORDSIZE != 32
- template <>
- inline py::object GET_ITEM_BORROW<py::tuple>(const py::handle& container, const int& item) {
-     return py::reinterpret_borrow<py::object>(
-         PyTuple_GET_ITEM(container.ptr(), py::ssize_t_cast(item)));
- }
-+#endif
- template <>
- inline py::object GET_ITEM_BORROW<py::list>(const py::handle& container, const ssize_t& item) {
-     return py::reinterpret_borrow<py::object>(PyList_GET_ITEM(container.ptr(), item));
-@@ -185,11 +191,13 @@ inline py::object GET_ITEM_BORROW<py::list>(const py::handle& container, const s
-     return py::reinterpret_borrow<py::object>(
-         PyList_GET_ITEM(container.ptr(), py::ssize_t_cast(item)));
- }
-+#if __WORDSIZE != 32
- template <>
- inline py::object GET_ITEM_BORROW<py::list>(const py::handle& container, const int& item) {
-     return py::reinterpret_borrow<py::object>(
-         PyList_GET_ITEM(container.ptr(), py::ssize_t_cast(item)));
- }
-+#endif
- 
- template <typename Container, typename Item>
- inline py::object GET_ITEM_STEAL(const py::handle& container, const Item& item) {
-@@ -204,11 +212,13 @@ inline py::object GET_ITEM_STEAL<py::tuple>(const py::handle& container, const s
-     return py::reinterpret_steal<py::object>(
-         PyTuple_GET_ITEM(container.ptr(), py::ssize_t_cast(item)));
- }
-+#if __WORDSIZE != 32
- template <>
- inline py::object GET_ITEM_STEAL<py::tuple>(const py::handle& container, const int& item) {
-     return py::reinterpret_steal<py::object>(
-         PyTuple_GET_ITEM(container.ptr(), py::ssize_t_cast(item)));
- }
-+#endif
- template <>
- inline py::object GET_ITEM_STEAL<py::list>(const py::handle& container, const ssize_t& item) {
-     return py::reinterpret_steal<py::object>(PyList_GET_ITEM(container.ptr(), item));
-@@ -218,11 +228,13 @@ inline py::object GET_ITEM_STEAL<py::list>(const py::handle& container, const si
-     return py::reinterpret_steal<py::object>(
-         PyList_GET_ITEM(container.ptr(), py::ssize_t_cast(item)));
- }
-+#if __WORDSIZE != 32
- template <>
- inline py::object GET_ITEM_STEAL<py::list>(const py::handle& container, const int& item) {
-     return py::reinterpret_steal<py::object>(
-         PyList_GET_ITEM(container.ptr(), py::ssize_t_cast(item)));
- }
-+#endif
- 
- template <typename Container, typename Item>
- inline void SET_ITEM(const py::handle& container, const Item& item, const py::handle& value) {
-@@ -240,12 +252,14 @@ inline void SET_ITEM<py::tuple>(const py::handle& container,
-                                 const py::handle& value) {
-     PyTuple_SET_ITEM(container.ptr(), py::ssize_t_cast(item), value.inc_ref().ptr());
- }
-+#if __WORDSIZE != 32
- template <>
- inline void SET_ITEM<py::tuple>(const py::handle& container,
-                                 const int& item,
-                                 const py::handle& value) {
-     PyTuple_SET_ITEM(container.ptr(), py::ssize_t_cast(item), value.inc_ref().ptr());
- }
-+#endif
- template <>
- inline void SET_ITEM<py::list>(const py::handle& container,
-                                const ssize_t& item,
-@@ -258,12 +272,14 @@ inline void SET_ITEM<py::list>(const py::handle& container,
-                                const py::handle& value) {
-     PyList_SET_ITEM(container.ptr(), py::ssize_t_cast(item), value.inc_ref().ptr());
- }
-+#if __WORDSIZE != 32
- template <>
- inline void SET_ITEM<py::list>(const py::handle& container,
-                                const int& item,
-                                const py::handle& value) {
-     PyList_SET_ITEM(container.ptr(), py::ssize_t_cast(item), value.inc_ref().ptr());
- }
-+#endif
- 
- template <typename PyType>
- inline void AssertExact(const py::handle& object) {
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 0ecefa8df2..1f7ac3e069 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -13177,7 +13177,7 @@ (define-public python-treelib
 (define-public python-optree
   (package
     (name "python-optree")
-    (version "0.11.0")
+    (version "0.14.0")
     (source
      (origin
        (method git-fetch)
@@ -13187,21 +13187,21 @@ (define-public python-optree
        (file-name (git-file-name name version))
        (sha256
         (base32
-         "0sk5lm1xyxi7z0yjckip77qvbidyb7i1znmn9fz96q74hl9ffyan"))
-       (patches (search-patches "python-optree-fix-32-bit.patch"))))
+         "17zph1jgzk0zaanj7057qj8x5cml8j66ip0xmlbwmq4396hmdlbs"))))
     (build-system pyproject-build-system)
     (arguments
      (list
       #:test-flags
-      ;; This test fails due to a circular import
-      ''("-k" "not test_treespec_pickle_missing_registration")))
+      ;; These tests fails due to a circular import
+      '`("-k" ,(string-append "not test_treespec_pickle_missing_registration"
+                              " and not test_import_no_warnings"))))
     (propagated-inputs (list python-typing-extensions))
     (native-inputs
      (list python-pytest
            python-setuptools
            python-wheel
-           cmake
-           pybind11))
+           cmake-minimal
+           pybind11-2.13))
     (home-page "https://github.com/metaopt/optree")
     (synopsis "Optimized PyTree Utilities")
     (description "This package contains operations on PyTrees (a tree made of
-- 
2.46.0