-
Notifications
You must be signed in to change notification settings - Fork 67
Fix an issue with the new Pillow update #462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| height = int.from_bytes(header[8:12], "big") | ||
| self._size = width, height | ||
| self.mode = "RGBA" | ||
| self._mode = "RGBA" |
There was a problem hiding this comment.
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
convertmethod is the correct way to change an image's mode.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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]
Pillow pulled some nonsense by making a breaking change in a minor version. Oops on them. Panic! at the Robot Factory.