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

Simplify Python code by passing tuples to C #8733

Merged
merged 2 commits into from
Feb 6, 2025

Conversation

radarhere
Copy link
Member

In code like the following

enc = _webp.WebPAnimEncoder(
im.size[0],
im.size[1],

there is no need to split the im.size tuple into multiple parts before passing it to C. We can pass just im.size by adjusting

Pillow/src/_webp.c

Lines 165 to 169 in 2810d7c

if (!PyArg_ParseTuple(
args,
"iiIiiiiii",
&width,
&height,

to receive a tuple.

@hugovk hugovk merged commit c73796d into python-pillow:main Feb 6, 2025
53 of 54 checks passed
@radarhere radarhere deleted the tuple branch February 6, 2025 11:20
radarhere added a commit to radarhere/Pillow that referenced this pull request Feb 6, 2025
radarhere added a commit to radarhere/Pillow that referenced this pull request Feb 7, 2025
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