Skip to content

[stubgen] infer_sig_from_docstring fails with python3.12 inline generic #17447

Open
@InvincibleRMC

Description

@InvincibleRMC

Bug Report

Trying to infer types from docstrings with python3.12 inline generics fails to generate.

To Reproduce

from mypy.stubdoc import infer_sig_from_docstring
infer_sig_from_docstring('\nfunc[T, V](x: T, y: V) -> T', 'func')

Expected Behavior

infer_sig_from_docstring('\nfunc[T, V](x: T, y: V) -> T', 'func') ==
            [
                FunctionSig(
                    name="func", args=[ArgSig(name="x", type="T"), ArgSig(name="y", type="V")], ret_type="T"
                )
            ]

Actual Behavior

infer_sig_from_docstring('\nfunc[T, V](x: T, y: V) -> T', 'func') == []

Your Environment

  • Mypy version used: 1.11.dev
  • Mypy command-line flags:
  • Mypy configuration options from mypy.ini (and other config files):
  • Python version used: python 3.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions