Closed
Description
Bug description
# pylint: disable=missing-docstring
from enum import Enum
from functools import cache
class Class(Enum):
A = 1
@cache
def func(self) -> None:
pass
Configuration
No response
Command used
pylint demo.py
Pylint output
W1518: 'lru_cache(maxsize=None)' or 'cache' will keep all method args alive indefinitely, including 'self' (method-cache-max-size-none)
Expected behavior
Pylint shouldn't complain about this, the code is perfectly fine.
Repeated calls to Class(1).func()
will not grow the cache, nor prevent anything from being garbage collected.
Pylint version
pylint 2.15.6
astroid 2.12.13
Python 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)]
OS / Environment
No response
Additional dependencies
No response