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

Added option for different arg/return type hints to type_caster #5358

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Commits on Sep 6, 2024

  1. Added option to add return_name to custom type_caster.

    This allows to define different python type hints for arguments and
    return value. This is implemented using template class `as_return_type`
    in order to check if `return_name` is available in the `type_caster` at
    compile time. If `return_name` is not available, it falls back to the
    previous usage of `name` for both args and return value.
    timohl committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    dd829c5 View commit details
    Browse the repository at this point in the history
  2. Applied return_name to type_caster for std::fileystem::path.

    The `type_caster` previously named `os.PathLike` as both argument and
    return type. This is inaccurate since it also takes `str` and `byte` as
    argument and actually returns `Path`. This commit uses the new
    `return_name` feature to define argument type as
    `Union[os.PathLike, str, bytes]` and return type as `Path`.
    An assert was added to the unit test for this.
    timohl committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    7e7f9ce View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e8aa81b View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    85052af View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    23ceaba View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    7d16bad View commit details
    Browse the repository at this point in the history