Skip to content

function typing info is lost after applying functools.lru_cache #6668

@raceychan

Description

@raceychan

Note: if you are reporting a wrong signature of a function or a class in the standard library, then the typeshed tracker is better suited for this report: https://github.com/python/typeshed/issues.

If you have a question about typing or a behavior that you’re seeing in Pyright (as opposed to a bug report or enhancement request), consider posting to the Pyright discussion forum.

Describe the bug
I read that [a wrong signature of a function or a class in the standard library] should be reported to typeshed
but the signature of functools.lru_cache seems to be doing fine, however,
when a function is decorated by functools.lru_cache, its typing info would be lost

Code or Screenshots
image

@lru_cache
def test(a: int) -> int:
    return a


test() # this woud not show any error

If your code relies on symbols that are imported from a third-party library, include the associated import statements and specify which versions of those libraries you have installed.

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?
vscode latest version

Metadata

Metadata

Assignees

No one assigned

    Labels

    as designedNot a bug, working as intendedbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions