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
Contributor

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>
@ax3l ax3l added enhancement New feature or request bug Something isn't working and removed enhancement New feature or request labels Jun 3, 2026
@ax3l

ax3l commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Restarting CI

@ax3l ax3l closed this Jun 3, 2026
@ax3l ax3l reopened this Jun 3, 2026
@ax3l ax3l requested review from ax3l, sizmailov, skarndev and virtuald June 3, 2026 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants