diff --git a/xbob/io/file.cpp b/xbob/io/file.cpp index e4b3cc65514c54996eb870efe4e6cdea1fdda55e..d7d13c6ad3723d870be68ece478d5e19565a3a0d 100644 --- a/xbob/io/file.cpp +++ b/xbob/io/file.cpp @@ -279,7 +279,11 @@ static PyObject* PyBobIoFile_GetIndex (PyBobIoFileObject* self, Py_ssize_t i) { static PyObject* PyBobIoFile_GetSlice (PyBobIoFileObject* self, PySliceObject* slice) { Py_ssize_t start, stop, step, slicelength; +#if PY_VERSION_HEX < 0x03000000 + if (PySlice_GetIndicesEx(slice, +#else if (PySlice_GetIndicesEx(reinterpret_cast<PyObject*>(slice), +#endif self->f->size(), &start, &stop, &step, &slicelength) < 0) return 0; //creates the return array diff --git a/xbob/io/hdf5.cpp b/xbob/io/hdf5.cpp index 68ff7834d82bbefa48b9b9fd34b3727c7e987793..2bdb2e03af85985d9a65bd2c5bad854d81be9f38 100644 --- a/xbob/io/hdf5.cpp +++ b/xbob/io/hdf5.cpp @@ -868,7 +868,10 @@ value >= 0, or a list of arrays otherwise.\n\ */ static void null_char_array_deleter(char*) {} + +#if PY_VERSION_HEX >= 0x03000000 static void char_array_deleter(char* o) { delete[] o; } +#endif static std::shared_ptr<char> PyBobIo_GetString(PyObject* o) { diff --git a/xbob/io/videoreader.cpp b/xbob/io/videoreader.cpp index f5f499c874b1500612412b125f544ab4dcd0d551..8f4063b1375c49f5094d64dabbc8aba2ef08e091 100644 --- a/xbob/io/videoreader.cpp +++ b/xbob/io/videoreader.cpp @@ -457,7 +457,11 @@ static PyObject* PyBobIoVideoReader_GetIndex (PyBobIoVideoReaderObject* self, Py static PyObject* PyBobIoVideoReader_GetSlice (PyBobIoVideoReaderObject* self, PySliceObject* slice) { Py_ssize_t start, stop, step, slicelength; - if (PySlice_GetIndicesEx(reinterpret_cast<PyObject*>(slice), +#if PY_VERSION_HEX < 0x03000000 + if (PySlice_GetIndicesEx(slice, +#else + if (PySlice_GetIndicesEx(reinterpret_cast<PyObject*>(slice), +#endif self->v->numberOfFrames(), &start, &stop, &step, &slicelength) < 0) return 0; //creates the return array