Skip to content

Simplify Python code by passing tuples to C#8733

Merged
hugovk merged 2 commits intopython-pillow:mainfrom
radarhere:tuple
Feb 6, 2025
Merged

Simplify Python code by passing tuples to C#8733
hugovk merged 2 commits intopython-pillow:mainfrom
radarhere:tuple

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants