-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Investigate use of lru_cache
on methods
#5670
Comments
you probably also want to ban |
Thanks @asottile! Wasn't sure whether if you would appreciate being tagged but I did wonder if there were other troublesome functions. I'll open an issue for |
yeah that would likely have the same issues |
@DanielNoord good job on your work here. The lru_cache is core Python functionality & the Python developers seem to be saying here that this is expected behaviour of the lru cache: https://bugs.python.org/issue19859. |
Hmm perhaps you are right. It is at |
I think especially the line in the warning - |
I like the phrasing from Radomir Dopieralski's suggestion:
I think the phrasing from the proposed warning need to be clear that this is not unwanted all the time. Maybe we only need to display the warning if |
That's actually a good improvement. I don't have time today but should have before
|
I'm moving this to the I'm keeping this open as reminder to myself that I need to implement the check for |
Note to self: we should also disallow |
What is the reason pylint requires explicitly providing a value for |
Thanks for the report, that looks like an oversight. Since that's a false positive in a released version, that's eligible for a patch release. (As opposed to this ticket, which looks like it's still open as an enhancement tracker for |
@DanielNoord would you mind opening a new issue for the below? I'd like to close this ticket and force all discussion into new issues.
|
EDIT: |
@jacobtylerwalls I have openend a PR implementing the issue. Should have done so earlier. Let me know if you still want me to create a new issue 👍 |
Problem
I stumbled upon this video which explains problems with using
lru_cache
on methods as it leaksself
. I haven't watched the full video yet but watched the previous video and saw the PR atpytest
here: pytest-dev/pytest#9148This is something we're doing ourselves as well and could be a potential source of memory leaks and other problems. I think this warrants an investigation and probably a refactor.
I have also opened pylint-dev/astroid#1344 to track this.
I think after the investigation of internal use it might make sense to perhaps turn this into a checker? I'll report after I have finished my investigation whether that might be useful.
The text was updated successfully, but these errors were encountered: