Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perform two passes in the variant caster #769

Merged
merged 1 commit into from
Nov 4, 2024
Merged

Commits on Nov 3, 2024

  1. Perform two passes in the variant caster

    When converting a Python object that wraps a `T` to a
    `std::variant<U,T>`, where `U` is implicitly convertible
    from `T`, the variant caster will cast to the `U` (even though the
    Python object is definitely a `T`)
    
    The included test case demonstrates the issue. pybind11 does two pass
    conversion in this case. One can work around the issue by using
    `noconvert()` on the argument. But it seems that it would be a
    friendlier default to make type conversions in a variant work as
    expected.
    tjstum committed Nov 3, 2024
    Configuration menu
    Copy the full SHA
    b14f046 View commit details
    Browse the repository at this point in the history