Simplified code by radarhere · Pull Request #8235 · 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

#8216 has changed the code to return early if axis_name is NULL.

Pillow/src/_imagingft.c

Lines 1311 to 1319 in 6944e9e

axis_name = Py_BuildValue("y#", name.string, name.string_len);
if (axis_name == NULL) {
Py_DECREF(list_axis);
Py_DECREF(list_axes);
FT_Done_MM_Var(library, master);
return NULL;
}
PyDict_SetItemString(
list_axis, "name", axis_name ? axis_name : Py_None);

So the ternary condition can be removed.

Copy link Copy Markdown

Contributor

@lysnikolaou lysnikolaou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I missed this while working on this part of the code. Thanks for noticing!

@hugovk hugovk merged commit 2152a17 into python-pillow:main

Jul 15, 2024

@radarhere radarhere deleted the axis_name branch

July 15, 2024 12:53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer

@lysnikolaou lysnikolaou lysnikolaou approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@radarhere @lysnikolaou @hugovk