[stubgen] infer_sig_from_docstring fails with python3.12 inline generic
Open
Nobody has claimed this yet.
bug
topic-pep-695
topic-stubgen
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the mypy.stubdoc.infer_sig_from_docstring entry point and reproduce the issue with the supplied Python call using an inline generic signature. Done means the call returns one FunctionSig for func with x and y arguments and return type T, rather than an empty list.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100