Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B109: Documentation/error message is wrong about the violation scope #408

Closed
stefan6419846 opened this issue Sep 12, 2023 · 2 comments
Closed

Comments

@stefan6419846
Copy link

I find the current wording confusing when just reading the error description of B109 for evaluation.

Example:

import functools

@functools.lru_cache(maxsize=1)
def get_value():
    return 42

Given

B019: Use of functools.lru_cache or functools.cache on methods can lead to memory leaks. The cache may retain instance references, preventing garbage collection.

the above example should report a violation, as get_value() is a method. Judging from the code and #250, standalone methods do not fall into the scope of B019, thus the current description is misleading.

@JelleZijlstra
Copy link
Collaborator

get_value() isn't a method, it's a function. Methods exist in classes.

@stefan6419846
Copy link
Author

Okay, than this seems to be a vocabulary issue/different terminology than I am used to - I have never really considered making a difference about the term "method" and "function".

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

No branches or pull requests

2 participants