Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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")

@hugovk hugovk added the Deprecation Feature that will be removed in the future label Jul 29, 2021
Co-authored-by: Hugo van Kemenade <[email protected]>
@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