Skip to content

Fix cachetools decorators - #5690

Merged
JelleZijlstra merged 1 commit into
python:masterfrom
coveord:fix/cachetools-decorators
Jun 25, 2021
Merged

JelleZijlstra merged 1 commit into
python:masterfrom
coveord:fix/cachetools-decorators

Conversation

@JHeilCoveo

@JHeilCoveo JHeilCoveo commented Jun 25, 2021 •

Copy link
Copy Markdown
Contributor

What

Fix cachetools' decorators by using IdentiyFunction. I based this PR off #5482.

Why

This simple code currently fails

from cachetools.func import ttl_cache


@ttl_cache(ttl=1)
def simple(a: int) -> int:
    return a + 1


if __name__ == "__main__":
    print(simple(1))

With following error messages :

simple.py:12: error: Argument 1 has incompatible type "Callable[[int], int]"; expected
simple.py:18: error: not callable

Fixes #5617

@JelleZijlstra
JelleZijlstra merged commit 64c85cd into python:master Jun 25, 2021
@JHeilCoveo
JHeilCoveo deleted the fix/cachetools-decorators branch August 19, 2021 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cachetools.func doesn't work

2 participants