You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After the image was closed, I expected all operations that involve loading or mutation to raise ValueError: Operation on closed image.
I tested WebPImageFile and it behaved as expected.
SInce PIL.Image.Image provides no public interface to determine if an image is closed or not, the next point of call would be trying an operation on the image to see if a specific exception is raised. The inconsistency shown above breaks that behaviour.
What actually happened?
Operations on the closed image don't raise the expected exception after seeking backward.
What are your OS, Python and Pillow versions?
OS: Pop OS 21.10 (Linux)
Python: 3.9.10
Pillow: 9.1.0
fromPILimportImageimg=Image.open("tests/images/lion.gif")
img.seek(4) # Okimg.close() # Okimg.load() # Ok; ValueError: Operation on closed imageimg.seek(5) # Ok; ValueError: Operation on closed imageimg.seek(0) # Not Ok; AttributeError: 'NoneType' object has no attribute 'seek'img.tell() # Not Ok; -1img.seek(5) # Not Ok; AttributeError: 'NoneType' object has no attribute 'seek'img.load() # Not Ok; AttributeError: 'NoneType' object has no attribute 'read'
The text was updated successfully, but these errors were encountered:
What did you do?
What did you expect to happen?
After the image was closed, I expected all operations that involve loading or mutation to raise
ValueError: Operation on closed image
.I tested
WebPImageFile
and it behaved as expected.SInce
PIL.Image.Image
provides no public interface to determine if an image is closed or not, the next point of call would be trying an operation on the image to see if a specific exception is raised. The inconsistency shown above breaks that behaviour.What actually happened?
Operations on the closed image don't raise the expected exception after seeking backward.
What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: