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

Only import numpy when necessary #5323

Merged
merged 1 commit into from Mar 28, 2021

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented Mar 11, 2021

Resolves #5320

Moves ImageFilter numpy import into the ImageFilter.Color3DLUT constructor, so that numpy is not imported only to be unused.

@basilgello
Copy link

And still adding an optional parameter to Color3DLut constructor disabling numpy usage might be perfect solution for those who want to stop using numpy within Pillow (for example if a buggy version installed in the system is out of their control).

@radarhere
Copy link
Member Author

But that wouldn't help your situation, because you're not the one calling Color3DLUT, right?

@basilgello
Copy link

basilgello commented Mar 11, 2021 via email

@radarhere
Copy link
Member Author

I'm not sold on the idea that Pillow should be adding workarounds for uncommon numpy bugs.

That said, I am willing to accept that from an efficiency standpoint, it could be better for Pillow not to import numpy if it isn't actually going to be used.

I've updated this PR, so that it now does a rudimentary check to see if table is a numpy object. This creates a clear path for Pillow users to not import numpy in ImageFilter - just don't pass a numpy object to Color3DLut.

@basilgello
Copy link

basilgello commented Mar 12, 2021 via email

@hugovk
Copy link
Member

hugovk commented Mar 28, 2021

@basilgello Hi! Have you checked this PR yet? If it's good we can include it in Thursday's release. Thanks!

@basilgello
Copy link

basilgello commented Mar 28, 2021 via email

@hugovk hugovk merged commit b3a1de9 into python-pillow:master Mar 28, 2021
@radarhere radarhere deleted the imagefilter_numpy branch March 28, 2021 20:44
@cg00001
Copy link

cg00001 commented Apr 25, 2021

The python-pillow update on 2021-04-23 fixed my issue with Kodi 19, but one day later python-numpy was updated and crashes started again.
So I'm back to using Flatpak Kodi until this is sorted.

@radarhere
Copy link
Member Author

Let us know if you feel there is anything for us to do - but from discussion in #5320, I would think we've now done all we can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kodi v19 crashes when PIL imports numpy
4 participants