unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob 6a32c39bd8e1656c9b844a0a4014b4b64229ef5d 5431 bytes (raw)
name: packages/patches/python-optree-fix-32-bit.patch 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
 
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) {

debug log:

solving 6a32c39bd8e1656c9b844a0a4014b4b64229ef5d ...
found 6a32c39bd8e1656c9b844a0a4014b4b64229ef5d in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).