Skip to content

Conversation

@radarhere
Copy link
Member

Before #7641, # initialize mode cache made sense, as it came before initialising a dictionary.

def getmode(mode: str) -> ModeDescriptor:
"""Gets a mode descriptor for the given mode."""
global _modes
if not _modes:
# initialize mode cache
modes = {}

Now it doesn't make sense, as the cache is managed by @lru_cache, and the following line determining endianness has nothing to do with the cache.

@lru_cache
def getmode(mode: str) -> ModeDescriptor:
"""Gets a mode descriptor for the given mode."""
# initialize mode cache
endian = "<" if sys.byteorder == "little" else ">"

This PR removes the comment.

@hugovk hugovk merged commit 33a73b5 into python-pillow:main Apr 7, 2024
@radarhere radarhere deleted the imagemode branch April 7, 2024 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants