X Tutup
Skip to content

Use std::visit to exhaust std::variant possibilities.#30773

Open
anntzer wants to merge 1 commit intomatplotlib:text-overhaulfrom
anntzer:visit
Open

Use std::visit to exhaust std::variant possibilities.#30773
anntzer wants to merge 1 commit intomatplotlib:text-overhaulfrom
anntzer:visit

Conversation

@anntzer
Copy link
Contributor

@anntzer anntzer commented Nov 21, 2025

This makes it unnecessary to silence impossible "unhandled" cases. See #30607 (comment).

PR summary

PR checklist

This makes it unnecessary to silence impossible "unhandled" cases.
Copy link
Member

@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

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

IIRC, the reason for the std::get_if with an else instead of a plain std::get was that some old macOS deployment target didn't have the implementation. Since cibuildwheel appears okay with this build, I think this should be okay for us and looks clearer, for the most part.

Copy link
Member

@story645 story645 left a comment

Choose a reason for hiding this comment

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

Not a blocker, but is there a reason to not factor the repeated load flags code into its own function?

Also can you fix the coverage?

@anntzer
Copy link
Contributor Author

anntzer commented Jan 22, 2026

The coverage is essentially about trying to hit each one of these deprecated APIs to verify that the deprecation works correctly. I wouldn't bother about it; if you really want coverage I'd rather wait until 3.11 is released and we're left with just the handling of languages (which is already correctly covered).

@story645
Copy link
Member

That's fine by me but then can you do #pragma no cover or the like to explicitly flag these as not covered? I want to avoid propagating the lowered coverage.

@anntzer
Copy link
Contributor Author

anntzer commented Jan 22, 2026

I didn't look in depth but I suspect that excluding lines from coverage in c++ is tricky (linux-test-project/lcov#44).
Again I can revert all uses except the single one that's going to stay if you prefer.

@story645
Copy link
Member

Nah, I can take the wait til 3.11 option since it should be out soon.

@QuLogic QuLogic added this to the v3.12.0 milestone Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup