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
|
--- siplib/sip.h.in
+++ siplib/sip.h.in
@@ -1553,9 +1553,15 @@
#define sipIsExactWrappedType(wt) (sipTypeAsPyTypeObject((wt)->type) == (PyTypeObject *)(wt))
+#if PY_VERSION_HEX >= 0x03020000
+#define sipConvertFromSliceObject(o,len,start,stop,step,slen) \
+ PySlice_GetIndicesEx((o), (len), (start), (stop), \
+ (step), (slen))
+#else
#define sipConvertFromSliceObject(o,len,start,stop,step,slen) \
PySlice_GetIndicesEx((PySliceObject *)(o), (len), (start), (stop), \
(step), (slen))
+#endif
/*
--- siplib/voidptr.c
+++ siplib/voidptr.c
@@ -429,7 +429,11 @@
{
Py_ssize_t start, stop, step, slicelength;
+#if PY_VERSION_HEX >= 0x03020000
+ if (PySlice_GetIndicesEx(key, v->size, &start, &stop, &step, &slicelength) < 0)
+#else
if (PySlice_GetIndicesEx((PySliceObject *)key, v->size, &start, &stop, &step, &slicelength) < 0)
+#endif
return NULL;
if (step != 1)
@@ -486,7 +490,11 @@
{
Py_ssize_t stop, step;
+#if PY_VERSION_HEX >= 0x03020000
+ if (PySlice_GetIndicesEx(key, v->size, &start, &stop, &step, &size) < 0)
+#else
if (PySlice_GetIndicesEx((PySliceObject *)key, v->size, &start, &stop, &step, &size) < 0)
+#endif
return -1;
if (step != 1)
|