Skip to content

Conversation

@njooma
Copy link
Member

@njooma njooma commented Oct 16, 2023

Pillow pulled some nonsense by making a breaking change in a minor version. Oops on them. Panic! at the Robot Factory.

@njooma njooma requested a review from a team as a code owner October 16, 2023 16:50
@njooma njooma requested review from benjirewis, cheukt and maximpertsov and removed request for a team October 16, 2023 16:50
height = int.from_bytes(header[8:12], "big")
self._size = width, height
self.mode = "RGBA"
self._mode = "RGBA"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this mean from the release notes:

The convert method is the correct way to change an image's mode.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that's for existing images, but not for creating our own image decoder. The documentation states

An image plugin should contain a format handler derived from the PIL.ImageFile.ImageFile base class. This class should provide an _open method, which reads the file header and set at least the internal _size and _mode attributes so that mode and size are populated.

so we should be safe setting these private attrs here. (famous last words, given this PR)

Copy link
Member

@benjirewis benjirewis Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah gotcha; yeah they set self._mode in their example, too.

height = int.from_bytes(header[8:12], "big")
self._size = width, height
self.mode = "RGBA"
self._mode = "RGBA"
Copy link
Member

@benjirewis benjirewis Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah gotcha; yeah they set self._mode in their example, too.

raise NotImplementedError()

async def write_analog(self, pin: str, value: int, *, timeout: float | None = None, **kwargs):
raise NotImplementedError()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[q] how is this related to the mode change? just a drive-by?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup -- docs tests were failing because of a missed update to the example server. My bad, should've noted [flyby]

@njooma njooma merged commit b8cc2b2 into viamrobotics:rc-0.8.0 Oct 16, 2023
@njooma njooma deleted the hotfix/pillow-update branch October 16, 2023 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants