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

[Stubgenc] Fails to generate stub for Tuple special cases when using pybind11 #17394

Open
InvincibleRMC opened this issue Jun 17, 2024 · 0 comments · May be fixed by #17440
Open

[Stubgenc] Fails to generate stub for Tuple special cases when using pybind11 #17394

InvincibleRMC opened this issue Jun 17, 2024 · 0 comments · May be fixed by #17440
Labels
bug mypy got something wrong topic-stubgen

Comments

@InvincibleRMC
Copy link
Contributor

InvincibleRMC commented Jun 17, 2024

Bug Report

Using pybind11 v2.12.0 allows adding typing annotations for things. And it works great for most types but fails to properly parse the tuple special cases and so the stub is left without a type.

To Reproduce

I discovered while contributing to the pybind11 project.
I would recommend following there guide to building.
Once built move into the build/tests directory
And run the following command

stubgen -p pybind11_tests

Expected Behavior

Generate the following.

def annotate_tuple_empty(arg0: tuple[()]) -> None: ...
def annotate_tuple_variable_length(arg0: tuple[float, ...]) -> None: ...

Actual Behavior

Generated the following.

def annotate_tuple_empty(arg0) -> None: ...
def annotate_tuple_variable_length(arg0) -> None: ...

Your Environment

  • Mypy version used:
    mypy 1.10.0 (compiled: yes)
  • Mypy command-line flags:
    Inside pybind11/build/tests
stubgen -p pybind11_tests
  • Python version used:
    Python3.10
@InvincibleRMC InvincibleRMC added the bug mypy got something wrong label Jun 17, 2024
@InvincibleRMC InvincibleRMC changed the title [Stubgenc] Fails to generate stub for Empty Tuple [Stubgenc] Fails to generate stub for Empty Tuple when using pybind11 Jun 17, 2024
@InvincibleRMC InvincibleRMC changed the title [Stubgenc] Fails to generate stub for Empty Tuple when using pybind11 [Stubgenc] Fails to generate stub for Tuple special cases when using pybind11 Jun 17, 2024
@InvincibleRMC InvincibleRMC linked a pull request Jun 25, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-stubgen
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants