Skip to content

add angle brackets to docstring type stack parsing#311

Open
htruscott wants to merge 1 commit into
pybind:mainfrom
htruscott:stack_brackets
Open

add angle brackets to docstring type stack parsing#311
htruscott wants to merge 1 commit into
pybind:mainfrom
htruscott:stack_brackets

Conversation

@htruscott
Copy link
Copy Markdown

adds "<": ">" to the stack-parsing logic in ExtractSignaturesFromPybind11Docstrings._split_args_str and ExtractSignaturesFromPybind11Docstrings._split_str, allowing for C++ templated classes with multiple type arguments to be parsed properly.

Previously, due to the commas, each type in a template is parsed as a separate argument, leading to extra parameters in stubs with nonsensical (often duplicate) names. For example void f(std::pair<std::pair<std::int,std::string>, std::pair<std::int,std::string>> arg0) would get parsed as arg0: "std::pair<std::pair<std::int", std: ":int,std::string>", std: ":pair<std::int", std: ":string>>". The nonsensical type strings of course get converted to "...", but the extra duplicate names remain making the stubs unparseable. Adding brackets to the stack correctly activates the logic to only separate by commas if there are no enclosing brackets/parentheses/etc.

Signed-off-by: htruscott <harrison@harriscott.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant