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

Remove warning if NumPy failed to raise an error during conversion #8326

Merged
merged 1 commit into from
Aug 24, 2024

Conversation

radarhere
Copy link
Member

If an error is raised when converting an image to a NumPy array, NumPy < 1.23 doesn't raise an error. So #6594 added a warning for that scenario.

Pillow/src/PIL/Image.py

Lines 742 to 743 in d6cfebd

if parse_version(numpy.__version__) < parse_version("1.23"):
warnings.warn(str(e))

NumPy < 1.23 is EOL, so this explicit warning can be removed.

A caveat to this is that Ubuntu 22.04 still has NumPy 1.21 packaged. However, that version carries its own warning - https://github.com/python-pillow/Pillow/actions/runs/10500106794/job/29087976733#step:6:5394

/Pillow/Tests/test_image_array.py:51: DeprecationWarning: An exception was ignored while fetching the attribute __array_interface__ from an object of type 'JpegImageFile'. With the exception of AttributeError NumPy will always raise this exception in the future. Raise this deprecation warning to see the original exception. (Warning added NumPy 1.21)

So it is also ok for our custom warning to be removed for that scenario.

@hugovk hugovk merged commit f15034c into python-pillow:main Aug 24, 2024
53 checks passed
@radarhere radarhere deleted the numpy branch August 24, 2024 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants