-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Use enums for Modes and RawModes in C #9100
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
base: main
Are you sure you want to change the base?
Conversation
and change findMode() to match
Structs have better type safety, but they make allocation more difficult, especially when we have multiple Python modules trying to share the same code.
this is necessary to have python/typeshed#12791
Would you mind writing up an explanation for why this is helpful? |
One of the things that I'd like to do here is move (almost) all of this stuff from
The only thing here that can't be in the mode struct and static per mode is the linesize.
So that gains us a lot less complexity in (depending on the metadata standard) I'm hoping that we could statically generate the arrow mode metadata and store it there as well. This would work if it's just mode based, but it's less useful if it's going to include image specific metadata, like sizes. |
@eyedav I've got updates that fix the compilation errors and pass the tests here: https://github.com/wiredfool/Pillow/tree/mode_enums . I can't see how to make a PR or push against your repo -- there should be a setting somewhere to allow admins to push to this branch that you can enable. |
@wiredfool the setting to allow maintainers to push to this branch was actually already enabled, I just tried to uncheck and check it again a moment ago. Could you please try a second time? Otherwise, as a workaround I could temporarily add you as collaborator to my fork. |
@eyedav I've tried again with no luck. If you can add me I'd appreciate it. |
@@ -11,4 +11,4 @@ sphinx | |||
types-atheris | |||
types-defusedxml | |||
types-olefile | |||
types-setuptools | |||
types-setuptools>=75.2.0 |
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.
types-setuptools>=75.2.0 | |
types-setuptools |
We're currently at 80.9.0. I think this has sufficiently propagated?
[IMAGING_MODE_RGBa] = {"RGBa"}, [IMAGING_MODE_YCbCr] = {"YCbCr"}, | ||
|
||
[IMAGING_MODE_BGR_15] = {"BGR;15"}, [IMAGING_MODE_BGR_16] = {"BGR;16"}, | ||
[IMAGING_MODE_BGR_24] = {"BGR;24"}, |
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.
BGR;* modes (but not rawmodes) were removed in #9053
Rebase of PR #8510 (Use enums for Modes and RawModes in C) on latest main, done during EuroPython25's Sprint: creating a new PR as agreed with @wiredfool.