Skip to content

Value of type "P.args" is not indexable #11826

Closed
@wrobell

Description

@wrobell

Please consider

import typing as tp

P = tp.ParamSpec('P')

def decorator(f: tp.Callable[P, int]) -> tp.Callable[P, int]:
    def wrapper(*args: P.args, **kw: P.kwargs) -> int:
        print(args[0])
        return 0
    return wrapper

then

$ mypy t.py
t.py:7: error: Value of type "P.args" is not indexable
Found 1 error in 1 file (checked 1 source file)

I would expect no error, as args is indexable actually.

Mypy 0.930, Python 3.10.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions