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

Corrected error code #7177

Merged
merged 1 commit into from Jun 14, 2023
Merged

Corrected error code #7177

merged 1 commit into from Jun 14, 2023

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented May 21, 2023

Extracting a change from the draft PR #6926

Pillow/src/_imagingft.c

Lines 168 to 170 in 599979c

self->font_bytes = PyMem_Malloc(font_bytes_size);
if (!self->font_bytes) {
error = 65; // Out of Memory in Freetype.

On first glance, the PR simply stops this value from being hardcoded, by replacing it with FT_Err_Out_Of_Memory, as per https://freetype.org/freetype2/docs/reference/ft2-error_code_values.html.

However, 65 is actually not the out of memory error code. 65 is 0x41, and according to that FreeType doc, 0x40 is "out of memory", while 0x41 is "unlisted object". So this change is not just stylistic, but also corrects the error code.

@radarhere radarhere mentioned this pull request Jun 7, 2023
4 tasks
Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

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

Good to merge, maybe add a Co-authored-by?

Co-authored-by: nulano <nulano@nulano.eu>
@radarhere
Copy link
Member Author

Ok, I've updated the commit.

@hugovk hugovk merged commit 76a8e9c into python-pillow:main Jun 14, 2023
61 checks passed
@radarhere radarhere deleted the freetype branch June 14, 2023 06:10
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.

None yet

2 participants