pybind11
pybind11 copied to clipboard
Fix issue #3912 : invalid docstring generation of std::array <-> list caster
Description
- Fixes #3912, by removing size information from list, while this information is helpful, it generates invalid type signatures for mypy and other type checkers.
Suggested changelog entry:
* Fixes doc generation for std::array-list caster. Previously, signatures included the size of the list in a non-standard, non-spec compliant way.
This PR achieves MyPy compliance in exchange for potentially very confusing situations where a pybind11-bound function does not accept an input array, and the error message provides zero context why that is (input has the wrong size)
These signatures in pybind11 precede the time where MyPy was even a thing, so "non-standard non-spec compliant" seems a bit strong of a qualifier.
@Wjacob, in >=3.9 we can use the Annotated typing extension to specify the length of the list. Hmm, not sure if there is a standard compliant way to specify the type for anything besides Tuples though.
@Skylion007 @rwgk can we close this one?
Closing after #4679 was merged.