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

[stubgen] C++ signature in docstring falsely included in generated stubs #18206

Open
mattangus opened this issue Nov 28, 2024 · 0 comments
Open
Labels
bug mypy got something wrong

Comments

@mattangus
Copy link

Bug Report

When C/C++ signatures are included in the C modules docstring. It is parsed as an overload.

To Reproduce

This script for examples outputs 2 signatures:

import mypy.stubdoc

sigs = mypy.stubdoc.infer_sig_from_docstring(
    """
addLane(data: MyStruct) -> None

C++: addLane(const MyStruct data) --> void
""",
    "addLane",
)

if sigs is not None:
    for sig in sigs:
        print(sig)

Expected Behavior

There should only be one signature in the resulting stub.

Actual Behavior

there are two signatures produced

FunctionSig(name='addLane', args=[ArgSig(name='data', type='MyStruct', default=False)], ret_type='None')
FunctionSig(name='addLane', args=[ArgSig(name='constMyStructdata', type=None, default=False)], ret_type='void')

Your Environment

  • stubgen version: 1.13.0
  • Python version used: 3.12

I have a pull request to solve this, #17658

@mattangus mattangus added the bug mypy got something wrong label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

1 participant