microsoft / microsoft/pyright

Subsequent `partial` functions in a list are not type-checked

Open
#11,029 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
15.6k
Forks
1.8k
Avg merge
12h 13m
Merged PRs (30d)
52

Description

**Describe the bug**
Only the first `partial` function provided to a `Sequence[Callable[...]]` is type-checked. The subsequent ones are not.

**Code or Screenshots**

```python
from collections.abc import Callable, Sequence
from functools import partial
from typing import Any

def foo(a: int, b: str): ...

def compose(funcs: Sequence[Callable[[str], Any]]): ...

compose(
[
partial(foo, 2),

# This has the wrong signature (Callable[[int, str], Any]),
# but Pyright does not pick it up
partial(foo),
]
)

```

**VS Code extension or command-line**
Are you running pyright as a VS Code extension, a language server in another editor, integrated into Pylance, or the command-line tool? Which version?

This happens in both the VS Code extension and the CLI.

```sh
❯ uv run pyright --version
pyright 1.1.406
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied Python reproducer with Pyright 1.1.406 in the CLI and compare diagnostics for both partial calls. Done means the second partial(foo) is reported as incompatible with Callable[[str, Any]] in the CLI and VS Code extension.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.