Skip to content
Snippets Groups Projects
Commit fbb8428d authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Python2 C-API support (fine-tunning after Python3 changes)

parent 886ac8ee
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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) {
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment