-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
__eq__ works unexpectedly because the readonly tag changed oddly #5926
Comments
from PIL import Image
img = Image.new('RGB', (1, 1))
img.readonly # 0
img.tobytes()
img.readonly # 0 img = ImageGrab.grabclipboard()
img.readonly # 1
img.tobytes()
img.readonly # 0 need a PR? |
Why would |
It is not In my understanding,
Line 93 in 3f77466
Once the image is loaded, then the true situation is determined. In this case, the image is not readonly.
#5930 means that when Pillow 9.1 is released, due out on April 1, |
thank you for the detail reason. |
I don't think there is anything specific in If we were to change it, I would be more interested in setting it to Pillow values backwards compatibility, and I'm not personally convinced that |
the |
What did you do?
try to compare img, like
img != last_img
What did you expect to happen?
img != last_img
should beFalse
when didn't change the clipboard content.What actually happened?
img != last_img
isTrue
What are your OS, Python and Pillow versions?
Addition:
found the reason is
Pillow/src/PIL/Image.py
Line 630 in 05b6336
it will change to 0 after the
self.tobytes()
(2 lines after it) is executed, and cause a wrong==
answer even the picture in the clipboard hasn't been touched at all.The fix probably is moving that line to the last?
is the behavior intended?
The text was updated successfully, but these errors were encountered: