FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[MNT]: Remove macOS 10.12 compatibility from ft2font_wrapper · Issue #31963 · matplotlib/matplotlib · GitHub

Repository navigation

[MNT]: Remove macOS 10.12 compatibility from ft2font_wrapper #31963

Closed

Description

Summary

There are several comments in ft2font_wrapper.cpp related to macOS 10.12 compatibility:

FT2Font::LanguageType languages;
if (auto value = std::get_if<FT2Font::LanguageType>(&languages_or_str)) {
    languages = std::move(*value);
} else if (auto value = std::get_if<std::string>(&languages_or_str)) {
    languages = std::vector<FT2Font::LanguageRange>{
        FT2Font::LanguageRange{*value, 0, text.size()}
    };
} else {
    // NOTE: this can never happen as pybind11 would have checked the type in the
    // Python wrapper before calling this function, but we need to keep the
    // std::get_if instead of std::get for macOS 10.12 compatibility.
    throw py::type_error("languages must be str or list of tuple");
}

Since the ARC changes in PR #31855 requires macOS 10.14 or later, I believe that the above logic can be simplified.

My knowledge of the C++ std is very limited, Claude suggests using std::holds_alternative:

FT2Font::LanguageType languages;
if (std::holds_alternative<FT2Font::LanguageType>(languages_or_str)) {
    languages = std::move(std::get<FT2Font::LanguageType>(languages_or_str));
} else {
    languages = std::vector<FT2Font::LanguageRange>{
        FT2Font::LanguageRange{std::get<std::string>(languages_or_str), 0, text.size()}
    };
}

I'm happy to do this cleanup and submit a PR if someone with C++ knowledge can give guidance!

Proposed fix

No response

Activity

  1. QuLogic commented on Jul 17, 2026

    Member

    There is already a PR to remove these.

  2. added this to the v3.12.0 milestone on Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL