From nobody Mon Jul 08 16:25:00 2024 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WHqGN6dHNz5Q4TG; Mon, 08 Jul 2024 16:25:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WHqGN3yz7z49rl; Mon, 8 Jul 2024 16:25:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720455900; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UNWQAzMM3rhvQ7d4GcZP2dUI5E5OF3oDG0wWybHC5QQ=; b=tUey/u+/KTJmRPwwcbrKfcAm3gfGWOIH4acJfy1l1pg/+YIfmvarsDl3f2sGfS6fqqd8Ft S1Mm17Cap3xK3N7bGE6DdTImsFfT3MX4kdm/3ThLJ9MM/bSlapXAftCcYJnUQZ5Tl4uZgk cv6yiFBd0PoJqnTGYiyE3kUYgt3s23nBxSZfyck2/9VuuZ3LWju3hSFPW0k3LWEaEVFo2w earo1rZlJZTVH1WeTI3BXp8Yip9p+Kr+tp0ZmUfg0cBe9ssWoErdNM0jXAlZfh2T5BvrXy WwOlMpVliGEJ9rnKJGuqCy04AfTFSGiLtp6NmEYYWNJUncASa536poRW1keDTA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720455900; a=rsa-sha256; cv=none; b=xHkOurb5v07x2VsoFOSoLa1VWjB+I6QsknT5gbcgCK6xQKonc10EywCx2MVzHW6BGKjfgA 8bkWl60qC749eYyOvk5xfev90ddYT9MN3op76jF1MK8HWM9+EG7vHs4MK/CXStt6+UYwb2 TN+2RWlmhGzan3n9RJ5NwqqUH7tLYsVRM01HNFUcZPWIIkOy3m62sQVvYWwGmrDNOw+UVl jpMOiQLhT4G+5OhXmbuJZlexf+Oa5vuRjqNwVSQ+kSghEVINDz4a1uTqt827sjZPrl5Tg5 /loY+nKg0hJ687ykkRmXePe95af1YFrsSDEuk9jrbsV1WU5+5ZG20z3+DRHM4w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720455900; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UNWQAzMM3rhvQ7d4GcZP2dUI5E5OF3oDG0wWybHC5QQ=; b=LLa1auSHdmMLZ++jcsiiTusUWyT73lGC+fOAIKa0MuYN/8SWz0ubxXOb/tQmTR7H7eBh+7 JyWFTjBtnNHQRe1b23S2YG4EkKTiNgNpBWXDNJjS2V9XHgn88uVknLINgA3cVD5GHC1JDz Iqt8Cgo03RECe1lmEkobDoOV2QKyPOsF78cHW8myRupTM+Ri4V0lZDXaJhdqetxK0ZacVu 2Ry84vjWIAO2iSeEHEx55eh4Wl2XsyZxWKdXbwCi1TS+J6YPCKm+LxesrGhtQd5blgiS3P U030NpHvumC7YXvivxdptF16IqxxvPnt79+LyyoNptiLUvuwcdV762yQhRP2Hg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WHqGN3YX1zygC; Mon, 8 Jul 2024 16:25:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 468GP06X002365; Mon, 8 Jul 2024 16:25:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468GP07t002362; Mon, 8 Jul 2024 16:25:00 GMT (envelope-from git) Date: Mon, 8 Jul 2024 16:25:00 GMT Message-Id: <202407081625.468GP07t002362@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Po-Chuan Hsieh Subject: git: 347aff10f699 - main - devel/py-optree: Update to 0.12.1 List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-all@freebsd.org Sender: owner-dev-commits-ports-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sunpoet X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 347aff10f6997058596f122e6972d4bb9b196337 Auto-Submitted: auto-generated The branch main has been updated by sunpoet: URL: https://cgit.FreeBSD.org/ports/commit/?id=347aff10f6997058596f122e6972d4bb9b196337 commit 347aff10f6997058596f122e6972d4bb9b196337 Author: Po-Chuan Hsieh AuthorDate: 2024-07-08 16:21:37 +0000 Commit: Po-Chuan Hsieh CommitDate: 2024-07-08 16:21:37 +0000 devel/py-optree: Update to 0.12.1 Changes: https://github.com/metaopt/optree/releases --- devel/py-optree/Makefile | 5 +- devel/py-optree/distinfo | 6 +- devel/py-optree/files/patch-i386 | 397 --------------------------------------- 3 files changed, 5 insertions(+), 403 deletions(-) diff --git a/devel/py-optree/Makefile b/devel/py-optree/Makefile index f0002928bf47..290ecad1ab9a 100644 --- a/devel/py-optree/Makefile +++ b/devel/py-optree/Makefile @@ -1,6 +1,5 @@ PORTNAME= optree -PORTVERSION= 0.11.0 -PORTREVISION= 1 +PORTVERSION= 0.12.1 CATEGORIES= devel python MASTER_SITES= PYPI PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} @@ -17,7 +16,7 @@ BUILD_DEPENDS= cmake:devel/cmake-core \ ${PYTHON_PKGNAMEPREFIX}pybind11>=0:devel/py-pybind11@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}setuptools>=0:devel/py-setuptools@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}wheel>=0:devel/py-wheel@${PY_FLAVOR} -RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}typing-extensions>=4.0.0:devel/py-typing-extensions@${PY_FLAVOR} +RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}typing-extensions>=4.5.0:devel/py-typing-extensions@${PY_FLAVOR} USES= compiler:c++20-lang python USE_PYTHON= autoplist concurrent pep517 diff --git a/devel/py-optree/distinfo b/devel/py-optree/distinfo index 5fc02faf32d0..dd6b37e56598 100644 --- a/devel/py-optree/distinfo +++ b/devel/py-optree/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1711466150 -SHA256 (optree-0.11.0.tar.gz) = 8e6a46e95c3ea8546055087d6fe52a1dcd56de5182365f1469106cc72cdf3307 -SIZE (optree-0.11.0.tar.gz) = 123093 +TIMESTAMP = 1720447688 +SHA256 (optree-0.12.1.tar.gz) = 76a2240e7482355966a73c6c701e3d1f148420a77849c78d175d3b08bf06ff36 +SIZE (optree-0.12.1.tar.gz) = 140037 diff --git a/devel/py-optree/files/patch-i386 b/devel/py-optree/files/patch-i386 deleted file mode 100644 index 3bb59348376e..000000000000 --- a/devel/py-optree/files/patch-i386 +++ /dev/null @@ -1,397 +0,0 @@ -Obtained from: https://github.com/metaopt/optree/commit/9a613a705ee18e18784ba3a16b2786f56f9c74d2 (based on) - ---- include/treespec.h.orig 2024-03-25 18:01:43 UTC -+++ include/treespec.h -@@ -19,6 +19,7 @@ limitations under the License. - - #include - -+#include // std::min - #include // std::unique_ptr - #include // std::optional, std::nullopt - #include // std::string -@@ -38,7 +39,10 @@ using ssize_t = py::ssize_t; - using ssize_t = py::ssize_t; - - // The maximum depth of a pytree. --constexpr ssize_t MAX_RECURSION_DEPTH = 1000; -+#ifndef Py_C_RECURSION_LIMIT -+#define Py_C_RECURSION_LIMIT 1000 -+#endif -+constexpr ssize_t MAX_RECURSION_DEPTH = std::min(1000, Py_C_RECURSION_LIMIT); - - // Test whether the given object is a leaf node. - bool IsLeaf(const py::object &object, ---- include/utils.h.orig 2024-03-25 18:01:43 UTC -+++ include/utils.h -@@ -208,6 +208,9 @@ inline ssize_t GET_SIZE(const py::handle& si - inline ssize_t GET_SIZE(const py::handle& sized) { - return PyList_GET_SIZE(sized.ptr()); - } -+#ifndef PyDict_GET_SIZE -+#define PyDict_GET_SIZE PyDict_GetSize -+#endif - template <> - inline ssize_t GET_SIZE(const py::handle& sized) { - return PyDict_GET_SIZE(sized.ptr()); -@@ -222,91 +225,35 @@ template <> - return PyTuple_GET_ITEM(container.ptr(), item); - } - template <> --inline py::handle GET_ITEM_HANDLE(const py::handle& container, const py::size_t& item) { -- return PyTuple_GET_ITEM(container.ptr(), py::ssize_t_cast(item)); --} --template <> --inline py::handle GET_ITEM_HANDLE(const py::handle& container, const int& item) { -- return PyTuple_GET_ITEM(container.ptr(), py::ssize_t_cast(item)); --} --template <> - inline py::handle GET_ITEM_HANDLE(const py::handle& container, const py::ssize_t& item) { - return PyList_GET_ITEM(container.ptr(), item); - } --template <> --inline py::handle GET_ITEM_HANDLE(const py::handle& container, const py::size_t& item) { -- return PyList_GET_ITEM(container.ptr(), py::ssize_t_cast(item)); --} --template <> --inline py::handle GET_ITEM_HANDLE(const py::handle& container, const int& item) { -- return PyList_GET_ITEM(container.ptr(), py::ssize_t_cast(item)); --} - - template - inline py::object GET_ITEM_BORROW(const py::handle& container, const Item& item) { -- return container[item]; -+ return py::reinterpret_borrow(container[item]); - } - template <> - inline py::object GET_ITEM_BORROW(const py::handle& container, const py::ssize_t& item) { - return py::reinterpret_borrow(PyTuple_GET_ITEM(container.ptr(), item)); - } - template <> --inline py::object GET_ITEM_BORROW(const py::handle& container, const py::size_t& item) { -- return py::reinterpret_borrow( -- PyTuple_GET_ITEM(container.ptr(), py::ssize_t_cast(item))); --} --template <> --inline py::object GET_ITEM_BORROW(const py::handle& container, const int& item) { -- return py::reinterpret_borrow( -- PyTuple_GET_ITEM(container.ptr(), py::ssize_t_cast(item))); --} --template <> - inline py::object GET_ITEM_BORROW(const py::handle& container, const py::ssize_t& item) { - return py::reinterpret_borrow(PyList_GET_ITEM(container.ptr(), item)); - } --template <> --inline py::object GET_ITEM_BORROW(const py::handle& container, const py::size_t& item) { -- return py::reinterpret_borrow( -- PyList_GET_ITEM(container.ptr(), py::ssize_t_cast(item))); --} --template <> --inline py::object GET_ITEM_BORROW(const py::handle& container, const int& item) { -- return py::reinterpret_borrow( -- PyList_GET_ITEM(container.ptr(), py::ssize_t_cast(item))); --} - - template - inline py::object GET_ITEM_STEAL(const py::handle& container, const Item& item) { -- return container[item]; -+ return py::reinterpret_steal(container[item]); - } - template <> - inline py::object GET_ITEM_STEAL(const py::handle& container, const py::ssize_t& item) { - return py::reinterpret_steal(PyTuple_GET_ITEM(container.ptr(), item)); - } - template <> --inline py::object GET_ITEM_STEAL(const py::handle& container, const py::size_t& item) { -- return py::reinterpret_steal( -- PyTuple_GET_ITEM(container.ptr(), py::ssize_t_cast(item))); --} --template <> --inline py::object GET_ITEM_STEAL(const py::handle& container, const int& item) { -- return py::reinterpret_steal( -- PyTuple_GET_ITEM(container.ptr(), py::ssize_t_cast(item))); --} --template <> - inline py::object GET_ITEM_STEAL(const py::handle& container, const py::ssize_t& item) { - return py::reinterpret_steal(PyList_GET_ITEM(container.ptr(), item)); - } --template <> --inline py::object GET_ITEM_STEAL(const py::handle& container, const py::size_t& item) { -- return py::reinterpret_steal( -- PyList_GET_ITEM(container.ptr(), py::ssize_t_cast(item))); --} --template <> --inline py::object GET_ITEM_STEAL(const py::handle& container, const int& item) { -- return py::reinterpret_steal( -- PyList_GET_ITEM(container.ptr(), py::ssize_t_cast(item))); --} - - template - inline void SET_ITEM(const py::handle& container, const Item& item, const py::handle& value) { -@@ -314,39 +261,15 @@ inline void SET_ITEM(const py::handle& cont - } - template <> - inline void SET_ITEM(const py::handle& container, -- const ssize_t& item, -+ const py::ssize_t& item, - const py::handle& value) { - PyTuple_SET_ITEM(container.ptr(), item, value.inc_ref().ptr()); - } - template <> --inline void SET_ITEM(const py::handle& container, -- const py::size_t& item, -- const py::handle& value) { -- PyTuple_SET_ITEM(container.ptr(), py::ssize_t_cast(item), value.inc_ref().ptr()); --} --template <> --inline void SET_ITEM(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()); --} --template <> - inline void SET_ITEM(const py::handle& container, -- const ssize_t& item, -+ const py::ssize_t& item, - const py::handle& value) { - PyList_SET_ITEM(container.ptr(), item, value.inc_ref().ptr()); --} --template <> --inline void SET_ITEM(const py::handle& container, -- const py::size_t& item, -- const py::handle& value) { -- PyList_SET_ITEM(container.ptr(), py::ssize_t_cast(item), value.inc_ref().ptr()); --} --template <> --inline void SET_ITEM(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()); - } - - inline std::string PyRepr(const py::handle& object) { ---- src/treespec/constructor.cpp.orig 2024-03-25 18:01:43 UTC -+++ src/treespec/constructor.cpp -@@ -78,7 +78,7 @@ template - std::vector& treespecs, - std::string& register_namespace) { - for (const py::object& child : children) { -- if (!py::isinstance(child)) { -+ if (!py::isinstance(child)) [[unlikely]] { - std::ostringstream oss{}; - oss << "Expected a(n) " << NodeKindToString(node) << " of PyTreeSpec(s), got " - << PyRepr(handle) << "."; -@@ -213,15 +213,15 @@ template - throw std::runtime_error(oss.str()); - } - node.arity = 0; -- node.node_data = GET_ITEM_BORROW(out, 1); -+ node.node_data = GET_ITEM_BORROW(out, ssize_t(1)); - for (const py::handle& child : -- py::cast(GET_ITEM_BORROW(out, 0))) { -+ py::cast(GET_ITEM_BORROW(out, ssize_t(0)))) { - ++node.arity; - children.emplace_back(py::reinterpret_borrow(child)); - } - verify_children(children, treespecs, registry_namespace); - if (num_out == 3) [[likely]] { -- py::object node_entries = GET_ITEM_BORROW(out, 2); -+ py::object node_entries = GET_ITEM_BORROW(out, ssize_t(2)); - if (!node_entries.is_none()) [[likely]] { - node.node_entries = py::cast(std::move(node_entries)); - const ssize_t num_entries = GET_SIZE(node.node_entries); ---- src/treespec/flatten.cpp.orig 2024-03-25 18:01:43 UTC -+++ src/treespec/flatten.cpp -@@ -144,14 +144,14 @@ bool PyTreeSpec::FlattenIntoImpl(const py::handle& han - throw std::runtime_error(oss.str()); - } - node.arity = 0; -- node.node_data = GET_ITEM_BORROW(out, 1); -+ node.node_data = GET_ITEM_BORROW(out, ssize_t(1)); - for (const py::handle& child : -- py::cast(GET_ITEM_BORROW(out, 0))) { -+ py::cast(GET_ITEM_BORROW(out, ssize_t(0)))) { - ++node.arity; - recurse(child); - } - if (num_out == 3) [[likely]] { -- py::object node_entries = GET_ITEM_BORROW(out, 2); -+ py::object node_entries = GET_ITEM_BORROW(out, ssize_t(2)); - if (!node_entries.is_none()) [[likely]] { - node.node_entries = py::cast(std::move(node_entries)); - const ssize_t num_entries = GET_SIZE(node.node_entries); -@@ -338,16 +338,16 @@ bool PyTreeSpec::FlattenIntoWithPathImpl(const py::han - throw std::runtime_error(oss.str()); - } - node.arity = 0; -- node.node_data = GET_ITEM_BORROW(out, 1); -+ node.node_data = GET_ITEM_BORROW(out, ssize_t(1)); - py::object node_entries; - if (num_out == 3) [[likely]] { -- node_entries = GET_ITEM_BORROW(out, 2); -+ node_entries = GET_ITEM_BORROW(out, ssize_t(2)); - } else [[unlikely]] { - node_entries = py::none(); - } - if (node_entries.is_none()) [[unlikely]] { - for (const py::handle& child : -- py::cast(GET_ITEM_BORROW(out, 0))) { -+ py::cast(GET_ITEM_BORROW(out, ssize_t(0)))) { - recurse(child, py::int_(node.arity++)); - } - } else [[likely]] { -@@ -355,7 +355,7 @@ bool PyTreeSpec::FlattenIntoWithPathImpl(const py::han - node.arity = GET_SIZE(node.node_entries); - ssize_t num_children = 0; - for (const py::handle& child : -- py::cast(GET_ITEM_BORROW(out, 0))) { -+ py::cast(GET_ITEM_BORROW(out, ssize_t(0)))) { - if (num_children >= node.arity) [[unlikely]] { - throw std::runtime_error( - "PyTree custom flatten function for type " + -@@ -500,9 +500,10 @@ py::list PyTreeSpec::FlattenUpTo(const py::object& ful - case PyTreeKind::DefaultDict: { - AssertExactStandardDict(object); - auto dict = py::reinterpret_borrow(object); -- py::list expected_keys = (node.kind != PyTreeKind::DefaultDict -- ? node.node_data -- : GET_ITEM_BORROW(node.node_data, 1)); -+ py::list expected_keys = -+ (node.kind != PyTreeKind::DefaultDict -+ ? node.node_data -+ : GET_ITEM_BORROW(node.node_data, ssize_t(1))); - if (!DictKeysEqual(expected_keys, dict)) [[unlikely]] { - py::list keys = SortedDictKeys(dict); - auto [missing_keys, extra_keys] = DictKeysDifference(expected_keys, dict); -@@ -619,7 +620,7 @@ py::list PyTreeSpec::FlattenUpTo(const py::object& ful - << " should return a 2- or 3-tuple, got " << num_out << "."; - throw std::runtime_error(oss.str()); - } -- py::object node_data = GET_ITEM_BORROW(out, 1); -+ py::object node_data = GET_ITEM_BORROW(out, ssize_t(1)); - if (node.node_data.not_equal(node_data)) [[unlikely]] { - std::ostringstream oss{}; - oss << "Mismatch custom node data; expected: " << PyRepr(node.node_data) -@@ -628,7 +629,7 @@ py::list PyTreeSpec::FlattenUpTo(const py::object& ful - } - ssize_t arity = 0; - for (const py::handle& child : -- py::cast(GET_ITEM_BORROW(out, 0))) { -+ py::cast(GET_ITEM_BORROW(out, ssize_t(0)))) { - ++arity; - agenda.emplace_back(py::reinterpret_borrow(child)); - } ---- src/treespec/traversal.cpp.orig 2024-03-25 18:01:43 UTC -+++ src/treespec/traversal.cpp -@@ -123,10 +123,10 @@ py::object PyTreeIter::NextImpl() { - << " should return a 2- or 3-tuple, got " << num_out << "."; - throw std::runtime_error(oss.str()); - } -- auto children = py::cast(GET_ITEM_BORROW(out, 0)); -+ auto children = py::cast(GET_ITEM_BORROW(out, ssize_t(0))); - ssize_t arity = GET_SIZE(children); - if (num_out == 3) [[likely]] { -- py::object node_entries = GET_ITEM_BORROW(out, 2); -+ py::object node_entries = GET_ITEM_BORROW(out, ssize_t(2)); - if (!node_entries.is_none()) [[likely]] { - const ssize_t num_entries = - GET_SIZE(py::cast(std::move(node_entries))); ---- src/treespec/treespec.cpp.orig 2024-03-25 18:01:43 UTC -+++ src/treespec/treespec.cpp -@@ -138,8 +138,8 @@ namespace optree { - - case PyTreeKind::DefaultDict: { - py::dict dict{}; -- py::object default_factory = GET_ITEM_BORROW(node.node_data, 0); -- py::list keys = GET_ITEM_BORROW(node.node_data, 1); -+ py::object default_factory = GET_ITEM_BORROW(node.node_data, ssize_t(0)); -+ py::list keys = GET_ITEM_BORROW(node.node_data, ssize_t(1)); - if (node.original_keys) [[unlikely]] { - for (ssize_t i = 0; i < node.arity; ++i) { - dict[GET_ITEM_HANDLE(node.original_keys, i)] = py::none(); -@@ -254,11 +254,11 @@ namespace optree { - auto expected_keys = py::reinterpret_borrow( - root.kind != PyTreeKind::DefaultDict - ? root.node_data -- : GET_ITEM_BORROW(root.node_data, 1)); -+ : GET_ITEM_BORROW(root.node_data, ssize_t(1))); - auto other_keys = py::reinterpret_borrow( - other_root.kind != PyTreeKind::DefaultDict - ? other_root.node_data -- : GET_ITEM_BORROW(other_root.node_data, 1)); -+ : GET_ITEM_BORROW(other_root.node_data, ssize_t(1))); - py::dict dict{}; - for (ssize_t i = 0; i < other_root.arity; ++i) { - dict[GET_ITEM_HANDLE(other_keys, i)] = py::int_(i); -@@ -530,7 +530,7 @@ ssize_t PyTreeSpec::PathsImpl(Span& paths, - auto keys = py::reinterpret_borrow( - root.kind != PyTreeKind::DefaultDict - ? root.node_data -- : GET_ITEM_BORROW(root.node_data, 1)); -+ : GET_ITEM_BORROW(root.node_data, ssize_t(1))); - for (ssize_t i = root.arity - 1; i >= 0; --i) { - cur -= recurse(cur, GET_ITEM_HANDLE(keys, i)); - } -@@ -595,7 +595,8 @@ py::list PyTreeSpec::Entries() const { - return py::getattr(root.node_data, Py_Get_ID(copy))(); - } - case PyTreeKind::DefaultDict: { -- return py::getattr(GET_ITEM_BORROW(root.node_data, 1), Py_Get_ID(copy))(); -+ return py::getattr(GET_ITEM_BORROW(root.node_data, ssize_t(1)), -+ Py_Get_ID(copy))(); - } - - default: -@@ -631,7 +632,8 @@ py::object PyTreeSpec::Entry(ssize_t index) const { - return GET_ITEM_BORROW(root.node_data, index); - } - case PyTreeKind::DefaultDict: { -- return GET_ITEM_BORROW(GET_ITEM_BORROW(root.node_data, 1), index); -+ return GET_ITEM_BORROW(GET_ITEM_BORROW(root.node_data, ssize_t(1)), -+ index); - } - - case PyTreeKind::None: -@@ -804,11 +806,11 @@ bool PyTreeSpec::IsPrefix(const PyTreeSpec& other, con - auto expected_keys = py::reinterpret_borrow( - a->kind != PyTreeKind::DefaultDict - ? a->node_data -- : GET_ITEM_BORROW(a->node_data, 1)); -+ : GET_ITEM_BORROW(a->node_data, ssize_t(1))); - auto other_keys = py::reinterpret_borrow( - b->kind != PyTreeKind::DefaultDict - ? b->node_data -- : GET_ITEM_BORROW(b->node_data, 1)); -+ : GET_ITEM_BORROW(b->node_data, ssize_t(1))); - py::dict dict{}; - for (ssize_t i = 0; i < b->arity; ++i) { - dict[GET_ITEM_HANDLE(other_keys, i)] = py::int_(i); -@@ -1023,9 +1025,9 @@ std::string PyTreeSpec::ToStringImpl() const { - case PyTreeKind::DefaultDict: { - EXPECT_EQ( - GET_SIZE(node.node_data), 2, "Number of auxiliary data mismatch."); -- py::object default_factory = GET_ITEM_BORROW(node.node_data, 0); -- auto keys = -- py::reinterpret_borrow(GET_ITEM_BORROW(node.node_data, 1)); -+ py::object default_factory = GET_ITEM_BORROW(node.node_data, ssize_t(0)); -+ auto keys = py::reinterpret_borrow( -+ GET_ITEM_BORROW(node.node_data, ssize_t(1))); - EXPECT_EQ(GET_SIZE(keys), - node.arity, - "Number of keys and entries does not match."); -@@ -1146,13 +1148,13 @@ std::string PyTreeSpec::ToString() const { - if (node.kind == PyTreeKind::DefaultDict) [[unlikely]] { - EXPECT_EQ( - GET_SIZE(node.node_data), 2, "Number of auxiliary data mismatch."); -- py::object default_factory = GET_ITEM_BORROW(node.node_data, 0); -+ py::object default_factory = GET_ITEM_BORROW(node.node_data, ssize_t(0)); - data_hash = py::hash(default_factory); - } - auto keys = py::reinterpret_borrow( - node.kind != PyTreeKind::DefaultDict - ? node.node_data -- : GET_ITEM_BORROW(node.node_data, 1)); -+ : GET_ITEM_BORROW(node.node_data, ssize_t(1))); - EXPECT_EQ( - GET_SIZE(keys), node.arity, "Number of keys and entries does not match."); - for (const py::handle& key : keys) {