Simplify Python code by passing tuples to C by radarhere · Pull Request #8733 · python-pillow/Pillow

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Conversation

@radarhere

Copy link Copy Markdown

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

@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

Reviewers

No reviews

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@radarhere @hugovk