An error occurred while fetching the assigned milestone of the selected merge_request.
Adds a delete method to reader.iter types
2 unresolved threads
2 unresolved threads
The video reader was not closing the video files when iteration did not finish all the way to the end.
Fixes #14 (closed)
Merge request reports
Activity
488 494 489 495 if ((*self->iter == self->pyreader->v->end()) || 490 496 (self->iter->cur() == self->pyreader->v->numberOfFrames())) { 491 self->iter->reset(); 492 self->iter.reset(); 493 Py_XDECREF((PyObject*)self->pyreader); 494 497 return 0; Iterators are not reusable! (see https://docs.python.org/3/library/stdtypes.html#iterator-types especially https://docs.python.org/3/library/stdtypes.html#iterator.iter)
Also from the link:
Once an iterator’s next() method raises StopIteration, it must continue to do so on subsequent calls. Implementations that do not obey this property are deemed broken.
so this merge request fixes that too.
586 589 PyBobIoVideoReaderIterator_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER; 587 590 588 591 PyBobIoVideoReaderIterator_Type.tp_new = PyType_GenericNew; 592 PyBobIoVideoReaderIterator_Type.tp_dealloc = reinterpret_cast<destructor>(PyBobIoVideoReaderIterator_Delete); https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_dealloc
destructor PyTypeObject.tp_dealloc A pointer to the instance destructor function. This function must be defined unless the type guarantees that its instances will never be deallocated (as is the case for the singletons None and Ellipsis).
mentioned in commit 49744015
Please register or sign in to reply