microsoft / pyright

Static Type Checker for Python
Other
12.7k stars 1.35k forks source link

Paramspec checking issue #8294

Closed hmc-cs-mdrissi closed 2 weeks ago

hmc-cs-mdrissi commented 2 weeks ago

Describe the bug

from collections.abc import Callable
from typing import ParamSpec

P = ParamSpec('P')

def call_f(f: Callable[P, object], *args: P.args, **kwargs: P.kwargs) -> object:
    return f(*args, **kwargs, name="foo")

This code type checks when name should be treated as invalid argument.

VS Code extension or command-line pyright cli 1.1.369. Fairly recent regression 1.1.366 correctly flags the error while 1.1.367 passes.

erictraut commented 2 weeks ago

This is addressed in pyright 1.1.370