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

Deprecate ImagePalette size parameter #5641

Merged
merged 2 commits into from Jul 29, 2021

Conversation

radarhere
Copy link
Member

Resolves #5636

The size parameter was originally added in #537. Before #5552, it was there to override a default length check.

if (size == 0 and len(self.mode) * 256 != len(self.palette)) or (
size != 0 and size != len(self.palette)
):
raise ValueError("wrong palette size")

Afterwards though, the default length check was gone, so size is now just adding an arbitrary constraint on the user - if provided, it throws an error if palette parameter is not the length of the size parmeter.

if size != 0 and size != len(self.palette):
raise ValueError("wrong palette size")

docs/deprecations.rst Outdated Show resolved Hide resolved
@hugovk hugovk added the Deprecation Feature that will be removed in the future label Jul 29, 2021
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
@hugovk hugovk added the automerge Automatically merge PRs that are ready label Jul 29, 2021
@mergify mergify bot merged commit 71b7f3d into python-pillow:master Jul 29, 2021
@radarhere radarhere deleted the palette_size branch July 30, 2021 00:25
radarhere added a commit to radarhere/Pillow that referenced this pull request Jul 31, 2021
radarhere added a commit to radarhere/Pillow that referenced this pull request Jul 31, 2021
hugovk added a commit that referenced this pull request Aug 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Automatically merge PRs that are ready Deprecation Feature that will be removed in the future Palette
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect documentation for ImagePalette size parameter (and maybe not needed at all)
2 participants