Skip to content

Conversation

@radarhere
Copy link
Member

@radarhere radarhere commented Nov 6, 2025

#9261 reports that pyright has a problem when iterating over the core Imaging instance returned from im.getdata().

There is already a comment in our codebase that returning a core Imaging instance from getdata() is a potential pitfall.

return self.im # could be abused

It would be better for users not to be given a C object they are unfamiliar with.

While users could adapt their code to getchannel() and tobytes() with some manipulation instead, I expect there would be pushback against removing this method entirely.

In practice, I expect that we could just change the output to a tuple, and most if not all code would continue to work, but I understand that changing the return type suddenly is not great in theory.

So this PR suggests deprecating the method, as a replacement, I have added get_flattened_data(), converting the core Imaging instance to a tuple.

@radarhere radarhere added the Deprecation Feature that will be removed in the future label Nov 6, 2025
@radarhere radarhere force-pushed the get_flattened_data branch 2 times, most recently from 000061e to 042abcf Compare November 6, 2025 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Deprecation Feature that will be removed in the future

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant