Closed trickeydan closed 4 years ago
Nice catch! Yeah mixin inheritance here is fun.
Surprised abc
and mypy
didn't catch this, but hey least it's a pretty simple fix.
Looks like there are a couple other cameras which use the "incorrect" inheritance order, which I'd be interested in also addressing in this PR.
Looks like there are a couple other cameras which use the "incorrect" inheritance order, which I'd be interested in also addressing in this PR.
Sorted.
When the inheritance of classes is in any other order for
Camera
, it results in the abstractcapture_frame
implementation being used instead of the implementation inVideoCaptureMixin
. This results inNotImplementedError
s whenever using either of these cameras. Interestingly, this is not caught by linting, typing or the runtime protections against executingabstractmethod
s.Code to reproduce bug before this patch:
Possible inheritance orders:
class Camera(BaseCamera, IterableCameraMixin, VideoCaptureMixin):
- Nopeclass Camera(IterableCameraMixin, VideoCaptureMixin, BaseCamera):
- Nope, idk whyclass Camera(VideoCaptureMixin, IterableCameraMixin, BaseCamera):
- Yes