Skip to content
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

Removed PixelAccess protocol #39

Closed
wants to merge 1 commit into from

Conversation

radarhere
Copy link

@radarhere radarhere commented Jun 15, 2024

Suggestion for python-pillow#8032

I think that after 10.4.0, we'll have no need for the PixelAccess protocol - we can just use core.PixelAccess. If so, then it's not helpful to add a public protocol only to remove it in the next version. This returns core.PixelAccess | PyAccess.PyAccess | None instead.

@nulano
Copy link
Owner

nulano commented Jun 19, 2024

Thanks. I wasn't sure how we wanted to refer to classes in core and figured a protocol would work, but this seems fine as well. (I was going to update the return type to clarify it instead, but didn't have time.)

This looks fine, except that the core.PixelAccess object only has __getitem__ and __setitem__, not getpixel and putpixel:
https://github.com/python-pillow/Pillow/blob/4b258be3bbedbdd54ef65140a14982b086d10c7b/src/_imaging.c#L3901-L3924

I've pushed a commit with that fixed instead.

@nulano nulano closed this Jun 19, 2024
@radarhere radarhere deleted the type_hints branch June 20, 2024 01:43
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