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

Round lut values where necessary #6188

Merged
merged 1 commit into from Apr 8, 2022
Merged

Conversation

radarhere
Copy link
Member

Resolves #6187

The issue reports that float lut values raise an error in Python 3.10 for im.point().

This would be because _point calls getlist(),

data = getlist(list, &n, wrong_number, TYPE_INT32);

which then calls PyLong_AsLong.

Pillow/src/_imaging.c

Lines 379 to 380 in 4996f84

case TYPE_INT32:
itemp = PyLong_AsLong(op);

https://docs.python.org/3/c-api/long.html#c.PyLong_AsLong

Changed in version 3.10: This function will no longer use __int__().

So this PR casts lut values to int first, except for the case where _point uses float values instead.

@radarhere radarhere changed the title Round lut values to integer when necessary Round lut values where necessary Apr 6, 2022
@hugovk hugovk merged commit 63f64de into python-pillow:main Apr 8, 2022
@radarhere radarhere deleted the point branch April 8, 2022 21:50
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.

'float' object cannot be interpreted as an integer exception when applying point transforms
2 participants