Skip to content

Stubgen moves non default keyword-only argument in front of * #11082

@khameeteman

Description

@khameeteman

Bug Report

Stubgen generates incorre stubs when a non default keyword-only argument is positioned after the asterix symbol in the signature.

To Reproduce

  1. Create a function:
def func(*, non_default_kwarg: bool, default_kwarg: bool = True):
    pass
  1. Generate stubs

Expected Behavior

def func(*, non_default_kwarg: bool, default_kwarg: bool=...) -> Any: ...

Actual Behavior

def func(non_default_kwarg: bool, *, default_kwarg: bool=...) -> Any: ...

Your Environment

  • Mypy version used: 0.812

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions