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 redundant part of condition #5915

merged 1 commit into from Dec 30, 2021

Removed redundant part of condition #5915

merged 1 commit into from Dec 30, 2021


Copy link

@radarhere radarhere commented Dec 30, 2021


Lines 806 to 815 in aa287bc

if mode == "RGBA":
mode = "RGB"["transparency"] = arr[3::4]
arr = bytes(
value for (index, value) in enumerate(arr) if index % 4 != 3
palette_length =, arr)
self.palette.dirty = 0
self.palette.rawmode = None
if "transparency" in and mode in ("RGBA", "LA", "PA"):

#5914 points out that mode will never be RGBA in the last line.

Unless I'm reading this incorrectly, the addition of the check on mode means that this won't ever evaluate to True, because mode is set back to RGB a few lines above?

Setting RGBA modes to RGB was introduced in #5089.

This PR just removes the check for RGBA in the last line, since it is not needed.

@hugovk hugovk merged commit 1d3fbf2 into python-pillow:main Dec 30, 2021
49 checks passed
@radarhere radarhere deleted the load branch Dec 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants