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

Add tp_richcompare handler for Imaging_Type/ImagingCore #7260

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Yay295
Copy link
Contributor

@Yay295 Yay295 commented Jul 5, 2023

Imaging_Type/ImagingCore is exposed by Image.getdata(), so this allows you to properly compare the result of that method without it being an identity comparison. This should also speed up comparison between Image objects, because now the comparison is done in C instead of passing the data back to Python for it to be compared.

Tests/test_lib_image.py Outdated Show resolved Hide resolved
@radarhere
Copy link
Member

Valgrind is currently failing - https://github.com/python-pillow/Pillow/actions/runs/5460694184/jobs/9937936242?pr=7260

Also, I went to test the speed of image equality with this, radarhere@98e02aa... and found https://github.com/radarhere/Pillow/actions/runs/5461893489/jobs/9940492884#step:8:4787

Fatal Python error: bool_dealloc: deallocating True or False: bug likely caused by a refcount error in a C extension

@Yay295
Copy link
Contributor Author

Yay295 commented Jul 5, 2023

oops, Py_NewRef wasn't added until Python 3.10.

Tests/test_lib_image.py Outdated Show resolved Hide resolved
Tests/test_lib_image.py Show resolved Hide resolved
src/_imaging.c Outdated Show resolved Hide resolved
Tests/test_lib_image.py Outdated Show resolved Hide resolved
Tests/test_lib_image.py Outdated Show resolved Hide resolved
Tests/test_lib_image.py Outdated Show resolved Hide resolved
@radarhere radarhere mentioned this pull request Apr 13, 2024
@Yay295 Yay295 force-pushed the image_equals branch 2 times, most recently from bbf5370 to 7eba51c Compare June 28, 2024 20:31
@Yay295 Yay295 force-pushed the image_equals branch 2 times, most recently from 0e86ed9 to 17faca4 Compare July 19, 2024 14:04
@Yay295 Yay295 force-pushed the image_equals branch 2 times, most recently from 1f8077d to d8012b3 Compare August 1, 2024 14:59
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.

3 participants