File: slice-32bit.patch

package info (click to toggle)
python-jpype 1.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,348 kB
  • sloc: python: 19,275; cpp: 18,049; java: 8,638; xml: 1,454; makefile: 155; sh: 37
file content (33 lines) | stat: -rw-r--r-- 1,268 bytes parent folder | download
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
From: Colin Watson <cjwatson@debian.org>
Date: Mon, 12 Jan 2026 10:36:16 +0000
Subject: Fix PySlice_CheckFull on 32-bit architectures

When a stepping-forward slice has no upper bound, `PySlice_Unpack` sets
`stop` to `PY_SSIZE_T_MAX`, not `-1`.  They happen to be the same on
some architectures, but that isn't portable.

Forwarded: https://github.com/jpype-project/jpype/pull/1336
Bug: https://github.com/jpype-project/jpype/issues/1029
Bug-Debian: https://bugs.debian.org/1123832
Last-Update: 2026-01-12
---
 native/python/pyjp_class.cpp | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/native/python/pyjp_class.cpp b/native/python/pyjp_class.cpp
index 029a359..4c800ed 100644
--- a/native/python/pyjp_class.cpp
+++ b/native/python/pyjp_class.cpp
@@ -726,11 +726,7 @@ static bool PySlice_CheckFull(PyObject *item)
 		return false;
 	Py_ssize_t start, stop, step;
 	int rc = PySlice_Unpack(item, &start, &stop, &step);
-#if defined(ANDROID)
-	return (rc == 0)&&(start == 0)&&(step == 1)&&((int) stop >= 0x7fffffff);
-#else
-	return (rc == 0)&&(start == 0)&&(step == 1)&&((int) stop == -1);
-#endif
+	return (rc == 0)&&(start == 0)&&(step == 1)&&(stop == PY_SSIZE_T_MAX);
 }
 
 static PyObject *PyJPClass_array(PyJPClass *self, PyObject *item)