http://www.riverbankcomputing.co.uk/hg/sip/rev/3d0336c32dfa http://www.riverbankcomputing.co.uk/hg/sip/rev/df42f6bf92c8 --- siplib/sip.h.in +++ siplib/sip.h.in @@ -1553,9 +1553,13 @@ #define sipIsExactWrappedType(wt) (sipTypeAsPyTypeObject((wt)->type) == (PyTypeObject *)(wt)) -#define sipConvertFromSliceObject(o,len,start,stop,step,slen) \ +#if PY_VERSION_HEX >= 0x03020000 +#define sipConvertFromSliceObject PySlice_GetIndicesEx +#else +#define sipConvertFromSliceObject(o, len, start, stop, step, slen) \ PySlice_GetIndicesEx((PySliceObject *)(o), (len), (start), (stop), \ (step), (slen)) +#endif /* --- siplib/siplib.c.in +++ siplib/siplib.c.in @@ -9216,9 +9216,9 @@ const sipClassTypeDef *ctd; if ((ptr = getPtrTypeDef(self, &ctd)) == NULL) - return -1; + return; - return ctd->ctd_releasebuffer((PyObject *)self, ptr, buf); + ctd->ctd_releasebuffer((PyObject *)self, ptr, buf); } #endif @@ -10686,7 +10686,11 @@ if ((wc = sip_api_malloc(ulen * sizeof (wchar_t))) == NULL) return -1; +#if PY_VERSION_HEX >= 0x03020000 + ulen = PyUnicode_AsWideChar(obj, wc, ulen); +#else ulen = PyUnicode_AsWideChar((PyUnicodeObject *)obj, wc, ulen); +#endif if (ulen < 0) { @@ -10737,7 +10741,11 @@ if (PyUnicode_GET_SIZE(obj) != 1) return -1; +#if PY_VERSION_HEX >= 0x03020000 + if (PyUnicode_AsWideChar(obj, ap, 1) != 1) +#else if (PyUnicode_AsWideChar((PyUnicodeObject *)obj, ap, 1) != 1) +#endif return -1; return 0; @@ -10793,7 +10801,11 @@ if ((wc = sip_api_malloc((ulen + 1) * sizeof (wchar_t))) == NULL) return -1; +#if PY_VERSION_HEX >= 0x03020000 + ulen = PyUnicode_AsWideChar(obj, wc, ulen); +#else ulen = PyUnicode_AsWideChar((PyUnicodeObject *)obj, wc, ulen); +#endif if (ulen < 0) { --- siplib/voidptr.c +++ siplib/voidptr.c @@ -429,7 +429,7 @@ { Py_ssize_t start, stop, step, slicelength; - if (PySlice_GetIndicesEx((PySliceObject *)key, v->size, &start, &stop, &step, &slicelength) < 0) + if (sipConvertFromSliceObject(key, v->size, &start, &stop, &step, &slicelength) < 0) return NULL; if (step != 1) @@ -486,7 +486,7 @@ { Py_ssize_t stop, step; - if (PySlice_GetIndicesEx((PySliceObject *)key, v->size, &start, &stop, &step, &size) < 0) + if (sipConvertFromSliceObject(key, v->size, &start, &stop, &step, &size) < 0) return -1; if (step != 1)