mypy icon indicating copy to clipboard operation
mypy copied to clipboard

stubgen generates bad signatures when mixing historical positional-only names and keyword-only parameters

Open brianschubert opened this issue 6 months ago • 0 comments

Bug Report

Given:

def f1(*, __kw): pass
def f2(x, /, *, __kw): pass

stubgen generates:

def f1(*, /, __kw) -> None: ...     # invalid syntax
def f2(x, *, /, __kw) -> None: ...  # invalid syntax

This sort of signature seems to be permitted by the typing spec based on this conformance test.

brianschubert avatar Jun 18 '25 21:06 brianschubert