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

[BUG]: Inconsistent case in annotations of python collections #4828

Closed
2 of 3 tasks
sizmailov opened this issue Aug 31, 2023 · 0 comments · Fixed by #4833
Closed
2 of 3 tasks

[BUG]: Inconsistent case in annotations of python collections #4828

sizmailov opened this issue Aug 31, 2023 · 0 comments · Fixed by #4833
Labels
triage New bug, unverified

Comments

@sizmailov
Copy link
Contributor

sizmailov commented Aug 31, 2023

Required prerequisites

What version (or hash if on master) of pybind11 are you using?

master

Problem description

Just realized the final version of #4259 was merged with annotations in lowercase, e.g. list, not List. The other parts of the pybind11 produce upper-case annotations for the same python type, but with different C++ counterpart, e.g. std::pair/std::tuple, std::array.

PEP 585 allows to replace the following types for Python-3.7+:

tuple # typing.Tuple
list # typing.List
dict # typing.Dict
set # typing.Set
frozenset # typing.FrozenSet
type # typing.Type

Reproducible example code

    m.def("mix", [](const std::array<int, 3> &, const py::typing::List<int>&) {});
print(demo.mix.__doc__)
# mix(arg0: Annotated[List[int], FixedSize(3)], arg1: list[int]) -> None
#                     ^^^^                            ^^^^

Is this a regression? Put the last known working version here if it is.

Not a regression

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage New bug, unverified
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant