You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[MNT]: Remove macOS 10.12 compatibility from ft2font_wrapper #31963
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);
} elseif (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.throwpy::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!
Activity
QuLogic commentedon Jul 17, 2026
There is already a PR to remove these.