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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃毃 fix linting warning (rule B019) #230

Merged
merged 2 commits into from
Feb 28, 2024
Merged

馃毃 fix linting warning (rule B019) #230

merged 2 commits into from
Feb 28, 2024

Conversation

DavidRomanovizc
Copy link
Contributor

@DavidRomanovizc DavidRomanovizc commented Feb 18, 2024

What was wrong?

The codebase currently use the lru_cache decorator in the NodeVisitor and ABIRegistry classes over methods. The flake8-bugbear linter reported a B019 warning, indicating potential memory leaks in class methods. The lru_cache decorator retain instance references, impeding garbage collection and potentially leading to memory-related issues.

Related to Issue #218
Closes #218

How was it fixed?

We don't have to replace lru_cache with something else for solve linter warning. This problem can be solved in the following way: we stopped using decorators directly over methods. Instead we apply the decorator function when initializing a class instance.

Todo:

  • Clean up commit history

  • Add or update documentation related to these changes

  • Add entry to the release notes

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@DavidRomanovizc
Copy link
Contributor Author

@pacrob could you review my PR, please? If you're not busy with something else, I'd appreciate your feedback

@pacrob
Copy link
Contributor

pacrob commented Feb 28, 2024

Looks great, @DavidRomanovizc ! Thanks for your help, I learned something today :)

@pacrob pacrob merged commit 6063bf1 into ethereum:main Feb 28, 2024
2 checks passed
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.

Replace functools.lru_cache
2 participants