Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

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

Simplify/improve error reporting from ft2font.#30102

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
QuLogic merged 1 commit intomatplotlib:mainfromanntzer:fterror
May 29, 2025

Conversation

anntzer
Copy link
Contributor

@anntzeranntzer commentedMay 24, 2025
edited
Loading

Provide a simple macro to call a FreeType function and throw an exception if an error is returned, while also including the source file and line location for the error. For example, tryingFT2Font(open("pyproject.toml", "rb")) now raises "FT_Open_Face (ft2font.cpp line 220) failed with error 0x02: unknown file format" instead of "Can not load face (unknown file format; error code 0x2)".

cf. discussion starting at#30059 (comment).

PR summary

PR checklist

Provide a simple macro to call a FreeType function and throwan exception if an error is returned, while also including thesource file and line location for the error.  For example, trying`FT2Font(open("pyproject.toml", "rb"))` now raises "FT_Open_Face(ft2font.cpp line 220) failed with error 0x2: unknown file format"instead of "Can not load face (unknown file format; error code 0x2)"
@QuLogicQuLogic added this to thev3.11.0 milestoneMay 29, 2025
@QuLogicQuLogic merged commit71e119b intomatplotlib:mainMay 29, 2025
40 of 41 checks passed
@QuLogic
Copy link
Member

I probably should have checkedcibuildwheel due to old macOS compat; this broke builds there:

        ../src/ft2font.cpp:220:5: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]            FT_CHECK(FT_Open_Face, _ft2Library, &open_args, 0, &face);            ^        ../src/ft2font.h:56:9: note: expanded from macro 'FT_CHECK'                THROW_FT_ERROR(#func, error_); \                ^        ../src/ft2font.h:46:5: note: expanded from macro 'THROW_FT_ERROR'            sprintf(buf, "%#04x", err); \            ^        /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here        __deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")        ^        /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'                #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))                                                              ^        ../src/ft2font.cpp:220:5: error: 'path' is unavailable: introduced in macOS 10.15            FT_CHECK(FT_Open_Face, _ft2Library, &open_args, 0, &face);            ^        ../src/ft2font.h:56:9: note: expanded from macro 'FT_CHECK'                THROW_FT_ERROR(#func, error_); \                ^        ../src/ft2font.h:49:28: note: expanded from macro 'THROW_FT_ERROR'        /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__filesystem/path.h:505:3: note: '~path' has been explicitly marked unavailable here          ~path() = default;          ^        ../src/ft2font.cpp:282:5: error: 'filename' is unavailable: introduced in macOS 10.15            FT_CHECK(FT_Set_Charmap, face, face->charmaps[i]);            ^        ../src/ft2font.h:56:9: note: expanded from macro 'FT_CHECK'                THROW_FT_ERROR(#func, error_); \                ^        ../src/ft2font.h:49:43: note: expanded from macro 'THROW_FT_ERROR'                + std::filesystem::path(__FILE__).filename().string() \                                                  ^        /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__filesystem/path.h:957:30: note: 'filename' has been explicitly marked unavailable here          _LIBCPP_HIDE_FROM_ABI path filename() const {                                     ^        ../src/ft2font.cpp:282:5: error: '~path' is unavailable: introduced in macOS 10.15            FT_CHECK(FT_Set_Charmap, face, face->charmaps[i]);            ^        ../src/ft2font.h:56:9: note: expanded from macro 'FT_CHECK'                THROW_FT_ERROR(#func, error_); \                ^        ../src/ft2font.h:49:43: note: expanded from macro 'THROW_FT_ERROR'                + std::filesystem::path(__FILE__).filename().string() \                                                  ^        /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__filesystem/path.h:505:3: note: '~path' has been explicitly marked unavailable here          ~path() = default;          ^        ../src/ft2font.cpp:282:5: error: 'string' is unavailable: introduced in macOS 10.15            FT_CHECK(FT_Set_Charmap, face, face->charmaps[i]);            ^        ../src/ft2font.h:56:9: note: expanded from macro 'FT_CHECK'                THROW_FT_ERROR(#func, error_); \                ^        ../src/ft2font.h:49:54: note: expanded from macro 'THROW_FT_ERROR'                + std::filesystem::path(__FILE__).filename().string() \                                                             ^        /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__filesystem/path.h:852:39: note: 'string' has been explicitly marked unavailable here          _LIBCPP_HIDE_FROM_ABI _VSTD::string string() const { return __pn_; }                                              ^        ../src/ft2font.cpp:287:5: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]            FT_CHECK(FT_Select_Charmap, face, (FT_Encoding)i);            ^        ../src/ft2font.h:56:9: note: expanded from macro 'FT_CHECK'                THROW_FT_ERROR(#func, error_); \                ^        ../src/ft2font.h:46:5: note: expanded from macro 'THROW_FT_ERROR'            sprintf(buf, "%#04x", err); \            ^        /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here        __deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")        ^        /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'                #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))                                                              ^        ../src/ft2font.cpp:287:5: error: 'path' is unavailable: introduced in macOS 10.15            FT_CHECK(FT_Select_Charmap, face, (FT_Encoding)i);            ^        ../src/ft2font.h:56:9: note: expanded from macro 'FT_CHECK'                THROW_FT_ERROR(#func, error_); \                ^        ../src/ft2font.h:49:28: note: expanded from macro 'THROW_FT_ERROR'                + std::filesystem::path(__FILE__).filename().string() \                                   ^        /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__filesystem/path.h:442:24: note: 'path' has been explicitly marked unavailable here        class _LIBCPP_TYPE_VIS path {                               ^        fatal error: too many errors emitted, stopping now [-ferror-limit=]

@anntzeranntzer deleted the fterror branchMay 30, 2025 08:31
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic approved these changes

@oscargusoscargusoscargus approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.11.0
Development

Successfully merging this pull request may close these issues.

3 participants
@anntzer@QuLogic@oscargus

[8]ページ先頭

©2009-2025 Movatter.jp