You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the representation of default values includes linebreaks, the function signature added to the docstring will include those linebreaks. Multiple tools only parse the docstring line by line for a signature (Sphinx, pybind11-stubgen), so this will break otherwise functional compatibility.
For me this commonly happens with Eigen matrix arguments represented as Numpy arrays. If the default value representation of the Numpy array exceeds 70 characters or has more than one dimension, linebreaks will be printed. Simply stripping newlines before adding the signature to the function record fixed the issue for me, but I'm not sure this behavior is desired (cf. #2621 (comment)).
Required prerequisites
What version (or hash if on master) of pybind11 are you using?
5ccb9e4
Problem description
If the representation of default values includes linebreaks, the function signature added to the docstring will include those linebreaks. Multiple tools only parse the docstring line by line for a signature (Sphinx, pybind11-stubgen), so this will break otherwise functional compatibility.
For me this commonly happens with Eigen matrix arguments represented as Numpy arrays. If the default value representation of the Numpy array exceeds 70 characters or has more than one dimension, linebreaks will be printed. Simply stripping newlines before adding the signature to the function record fixed the issue for me, but I'm not sure this behavior is desired (cf. #2621 (comment)).
Reproducible example code
This will produce the docstring:
Is this a regression? Put the last known working version here if it is.
Not a regression
The text was updated successfully, but these errors were encountered: