microsoft / microsoft/pyright

Keyword-only first argument in instance method not reported

Open
#11,036 1 comment 0 reactions 0 assignees View on GitHub
enhancement request
Dominant language
Python
Stars
15.6k
Forks
1.8k
Avg merge
12h 13m
Merged PRs (30d)
52

Description

Tested on Pyright 1.1.406, Python 3.14

```py
class A:
def meth1(*, x: int = 42) -> None:
pass

def meth2(*, x: int) -> None:
pass

A().meth1() # no error
A().meth2(x=57) # no error
```

Both method calls will fail at runtime. Pyright does not report any diagnostics for this file.

`mypy` does report errors both for the method definitions and for the calls (so that e.g. you can keep these functions if you need backwards compatibility, while still keeping type safety when they are used).

Contributor guide

Open the contributing guide

Research direction

Start with the Python reproducer in the issue and compare Pyright's behavior with mypy for the two keyword-only instance method definitions and calls. Trace the relevant Pyright analysis entry point, then add or update coverage so diagnostics are reported for both invalid definitions and calls, and verify the reproducer passes.

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
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.