镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Corrected error code - #7177

Merged
hugovk merged 1 commit into
python-pillow:mainfrom
radarhere:freetype
Jun 14, 2023
Merged

hugovk merged 1 commit into
python-pillow:mainfrom
radarhere:freetype

Conversation

@radarhere

@radarhere radarhere commented May 21, 2023 •

Copy link
Copy Markdown
Member

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

@hugovk hugovk left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
Member Author

Ok, I've updated the commit.

@hugovk
hugovk merged commit 76a8e9c into python-pillow:main Jun 14, 2023
@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.

2 participants